Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Video: skSynth playing MIDI files. Source code released.
Started by r.delia Jan 26 2014 06:18 PM

7 replies to this topic
midi synthesizer audio stinkykitties r.delia drums .mid
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

r.delia

[GLOBAL: userInfoPane.html]
r.delia
  • Contributor

  • 139 posts
  • Corona SDK

I started making a synthesizer, which would take a single instrument sample, and change its pitch via the undocumented audio api. 

 

After I got that wired up, I found a MIDI.lua file that would take a .mid file and load it into a 'score' or 'opus' table.

 

Here, I just winged it. I started by looping through all the song's track data , and started to build code to split channels into different instruments, etc. This is definitely not 'by the book' by any means, as I couldn't find a book... (lots of good references in the main.lua though)

 

I went through many stages and phases where the sound was popping terribly, notes were being missed, tempo was completely off, etc.  

 

Video:

 

 

Source Code: (try it yourself!  I've only tried it in the Mac Simulator, let me know how it works for you)

 

https://github.com/SK-Ray/skSynth



[TOPIC: post.html]
#2

Gremlin Interactive

[GLOBAL: userInfoPane.html]
Gremlin Interactive
  • Contributor

  • 700 posts
  • Enterprise

[TOPIC: post.html]
#3

r.delia

[GLOBAL: userInfoPane.html]
r.delia
  • Contributor

  • 139 posts
  • Corona SDK

[TOPIC: post.html]
#4

thegdog

[GLOBAL: userInfoPane.html]
thegdog
  • Contributor

  • 564 posts
  • Corona SDK

Kinda trippy.   :)



[TOPIC: post.html]
#5

tschussler

[GLOBAL: userInfoPane.html]
tschussler
  • Enthusiast

  • 97 posts
  • Corona SDK

That is just fun - thanks for sharing!



[TOPIC: post.html]
#6

greg886

[GLOBAL: userInfoPane.html]
greg886
  • Contributor

  • 909 posts
  • Corona SDK

Hi r.delia - just had a question I posted here - be interested in you happen to know based on the experiance you have?

 

http://forums.coronalabs.com/topic/48807-is-corona-as-good-as-a-native-objective-c-app-for-game-sound-controls-eg-midi-guitar-hero/



[TOPIC: post.html]
#7

greg886

[GLOBAL: userInfoPane.html]
greg886
  • Contributor

  • 909 posts
  • Corona SDK

just having a play 

 

Does MIDI.lua or SKCoronaSynth require there to be a META event at the start?   Just noting if you remove the channel that just has the upfront meta event that then the song won't play?



[TOPIC: post.html]
#8

r.delia

[GLOBAL: userInfoPane.html]
r.delia
  • Contributor

  • 139 posts
  • Corona SDK

Hi all! I just updated Github with a new feature that lets you get and set the base BPM of the loaded song. 

local BPM = skCoronaSynth:getTempo()
skCoronaSynth:setTempo(88)

 

@greg886 - The biggest issue to me, is that it makes the songs sound 'wobbly'. MIDI has a time resolution of microseconds.. and corona's 'clock' doesn't.  . I was observing up to 15ms of variance between delta times in my enter frame event, even on my mac.  It was a fun project, and 'close enough' so I didn't really dig much deeper.

 

for your 2nd question, I'm not sure if any events are required other than on/off for notes.  basically the listener function looks at each track, and tries to play any notes that should have already started :)




[topic_controls]
[/topic_controls]