Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-07-2009, 04:00 PM   #1 (permalink)
syd
New Member
 
Join Date: Feb 2009
Posts: 17
Default Playing musical instrument notes.

So I am like really new to the sdk and also to objective c,cocoa etc. I know C/C++but not sure how much of it would help.
I am not sure if this is a legit question to ask, but i have in mind another app that can play musical instruments.
I was just wondering what would be the best way to simulate all guitar/piano notes? do i have to record these notes myself and play it every time a touch is sensed?
There are too many apps that play musical instruments and i really doubt that they do it that way.
Thanks for your help in advance, I am really new to all this and being an amture programmer I am kind of overwhelmed!
Any other tips would be greatly appreciated.
syd is offline   Reply With Quote
Old 02-07-2009, 04:28 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 495
Default

Unfortunately I'm not aware of any great resources for synthesizing sounds or doing midi playback that are available for iPhone (non-jailbroken that is), though I know it's possible since obviously there are many apps doing it. Doing all the samples for an instrument could be a bit cumbersome.
__________________
My Apps on AppStore : gScale (guitar scales reference), eMaze, eMaze Lite, eTimesheet
exorcyze is offline   Reply With Quote
Old 02-07-2009, 04:42 PM   #3 (permalink)
syd
New Member
 
Join Date: Feb 2009
Posts: 17
Default

Quote:
Originally Posted by exorcyze View Post
Unfortunately I'm not aware of any great resources for synthesizing sounds or doing midi playback that are available for iPhone (non-jailbroken that is), though I know it's possible since obviously there are many apps doing it. Doing all the samples for an instrument could be a bit cumbersome.
So the only way you can play sound files is if they are in midi format?
I just find the method of recording all the notes probably not the best way to go, probably garage band can create those notes, i am not sure!
syd is offline   Reply With Quote
Old 02-07-2009, 04:43 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 495
Default

No, I had just meant if you *could* do midi playback on the iPhone it would make it easier than samples, since it could be generated programatically what notes to play. =)
__________________
My Apps on AppStore : gScale (guitar scales reference), eMaze, eMaze Lite, eTimesheet
exorcyze is offline   Reply With Quote
Old 02-07-2009, 04:55 PM   #5 (permalink)
syd
New Member
 
Join Date: Feb 2009
Posts: 17
Default

Quote:
Originally Posted by exorcyze View Post
No, I had just meant if you *could* do midi playback on the iPhone it would make it easier than samples, since it could be generated programatically what notes to play. =)
Can't figure out how they generate sounds otherwise! So should I just connect the guitar to my coMputer and start recording notes ?
syd is offline   Reply With Quote
Old 03-04-2009, 02:06 PM   #6 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 15
Post There is a way!!

Hey guys! Here's what I came up with:

Well I know you wanted to use MIDI... Me too, but I am leaning towards a different method at this point! Basic MIDI support does not seem like the type of wheel that I'd be interested in reinventing. months of work.

Here's a great example of how to loop AAC audio using an available function from the iPhone dev kit called "AudioQueueEnqueueBufferWithParameters". With this, you can achieve basic music playback/loopage. Yet another burried iphone sdk article lol:

iPhone Dev Center

If you are hell bent on using MIDI, you might as well just make the MIDI on your computer using some form of MIDI editing software, then convert it directly to AAC using something like Ease Midi Converter or Cool Edit etc.

I was pretty upset I couldn't find any MIDI related support, mostly because I like to keep things fairly optimized the first run through. (i.e, typically MIDI runs on the audio card, alleviating cycles from the CPU, and MIDI files tend to be smaller in size.) But oh well, this works quite well, and is better than nothing...

Hope this helps, Cheers!
marcond is offline   Reply With Quote
Old 03-04-2009, 02:16 PM   #7 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,178
Default

Quote:
Originally Posted by marcond View Post
Hey guys! Here's what I came up with:

Well I know you wanted to use MIDI... Me too, but I am leaning towards a different method at this point! Basic MIDI support does not seem like the type of wheel that I'd be interested in reinventing. months of work.

Here's a great example of how to loop AAC audio using an available function from the iPhone dev kit called "AudioQueueEnqueueBufferWithParameters". With this, you can achieve basic music playback/loopage. Yet another burried iphone sdk article lol:

iPhone Dev Center

If you are hell bent on using MIDI, you might as well just make the MIDI on your computer using some form of MIDI editing software, then convert it directly to AAC using something like Ease Midi Converter or Cool Edit etc.

I was pretty upset I couldn't find any MIDI related support, mostly because I like to keep things fairly optimized the first run through. (i.e, typically MIDI runs on the audio card, alleviating cycles from the CPU, and MIDI files tend to be smaller in size.) But oh well, this works quite well, and is better than nothing...

Hope this helps, Cheers!
Sorry, I've read this post and your other post saying essentially the same thing, and I fail to see how playing a sound in AAC format (or any of the other digital sound formats) is akin to playing sound via MIDI file. Apples and oranges.
Kalimba is offline   Reply With Quote
Old 03-04-2009, 02:48 PM   #8 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 15
Default Apples and Oranges

Quote:
Originally Posted by Kalimba View Post
Sorry, I've read this post and your other post saying essentially the same thing, and I fail to see how playing a sound in AAC format (or any of the other digital sound formats) is akin to playing sound via MIDI file. Apples and oranges.
,

Oops! sorry for not making it clearer Kalimba.. Let me explain, and add that, Apples and Oranges are still both Fruits aren't they? As are MIDI and AAC both forms of audio? Wouldn't you agree? Also note that saying "playing sound via MIDI file" is semantically not correct.. MIDI is just a sequence of bytes with a standardized representation of an instrument, note on/off op codes, as well as things like sustain, attack speed etc. This is interpreted by the sound card driver on your computer typically. iPhone does not give you access to the sound card driver in this way.. at least that I've found, if you've found something please tell me Kalimba.. But I understand your confusion I think.. I will elaborate further!! Before I do though.. Please understand the goal, people want to play sounds on the iPhone Kalimba, some people don't even know what "extension" to use.. AAC, MIDI, who cares, it's all relative.. I would bet money those sound board apps are not feeding the Sound card processor a stream of midi bytes. Because that's what I wanted to do, and spent 3 hours trying to find in apple forums and tech docs.. no go.. Save yourself some time.. Instead, why not use the MIDI sequencer/processor on your computers sound card! it's much more badass than an iPhone's anyways, and probably supports better MIDI synth..

If you need to Play individual notes, or any sound for that matter(Which is what the original posting was about), You can
1) Take an existing MIDI file that you have,fire up your fancy MIDI suite software. Or plug in the Exact note(s) you need to use (a lot of those music sound board apps you see are typically of the variety C/G major chord variations, so they always sound good, just ask Disney lol).
2) Once you have your sample, be it a whole song in midi or just a single note, save your midi file.. Now fire up the app as fore mentioned that will convert the MIDI to the ready to use AAC format.. Convert it over!
3) THEN, refer to the Technical Q&A on the apple forum in my previous post.
4) You will get sound working on your iPhone app

Again, I apologize for posting in two locations, people are struggling with this Kalimba, and I was simply trying to help, as this works for me. Keep your criticism positive and remember the original post(s) "how the hell do I play sound".. Well, here's one way! Or if you have something better, why not share instead of spending your time summing my post into a derogatory analogy lol!
marcond is offline   Reply With Quote
Old 03-04-2009, 03:00 PM   #9 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,178
Default

Quote:
Originally Posted by marcond View Post
,

Oops! sorry for not making it clearer Kalimba.. Let me explain, and add that, Apples and Oranges are still both Fruits aren't they? As are MIDI and AAC both forms of audio? Wouldn't you agree? Also note that saying "playing sound via MIDI file" is semantically not correct.. MIDI is just a sequence of bytes with a standardized representation of an instrument, note on/off op codes, as well as things like sustain, attack speed etc. This is interpreted by the sound card driver on your computer typically. iPhone does not give you access to the sound card driver in this way.. at least that I've found, if you've found something please tell me Kalimba.. But I understand your confusion I think.. I will elaborate further!! Before I do though.. Please understand the goal, people want to play sounds on the iPhone Kalimba, some people don't even know what "extension" to use.. AAC, MIDI, who cares, it's all relative.. I would bet money those sound board apps are not feeding the Sound card processor a stream of midi bytes. Because that's what I wanted to do, and spent 3 hours trying to find in apple forums and tech docs.. no go.. Save yourself some time.. Instead, why not use the MIDI sequencer/processor on your computers sound card! it's much more badass than an iPhone's anyways, and probably supports better MIDI synth..

If you need to Play individual notes, or any sound for that matter(Which is what the original posting was about), You can
1) Take an existing MIDI file that you have,fire up your fancy MIDI suite software. Or plug in the Exact note(s) you need to use (a lot of those music sound board apps you see are typically of the variety C/G major chord variations, so they always sound good, just ask Disney lol).
2) Once you have your sample, be it a whole song in midi or just a single note, save your midi file.. Now fire up the app as fore mentioned that will convert the MIDI to the ready to use AAC format.. Convert it over!
3) THEN, refer to the Technical Q&A on the apple forum in my previous post.
4) You will get sound working on your iPhone app

Again, I apologize for posting in two locations, people are struggling with this Kalimba, and I was simply trying to help, as this works for me. Keep your criticism positive and remember the original post(s) "how the hell do I play sound".. Well, here's one way! Or if you have something better, why not share instead of spending your time summing my post into a derogatory analogy lol!
Generalizing the issue to the concise bullet point of "MIDI and AAC are both sound files, so problem solved!" hardly addresses the original issue. Sure, if you want to take a 500 byte MIDI file, then "convert it" to AAC that'll work. Let's say your AAC file ends up being a megabyte, is that a realistic size for a song? Lol, I think it might be. So, great, you've effectively taken one "music" file and multiplied its size by a factor of over 2000 to get the other "music" file. But it's all just music, right? Lol. It's all the same. Problem solved. Lol. Apples are oranges as bananas are lemons. Lol. Lemonade for everyone!
Kalimba is offline   Reply With Quote
Old 03-04-2009, 03:36 PM   #10 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 15
Post For everyone else!

Give it a shot guys! I'm not sure what Kalimba's problem is, I told him I wanted MIDI support too lol, not like I'm advocating AAC over MIDI. My post wasn't even for him.. Somethin about fruit I don't know.. Anyways, this does work MIDI will be much smaller, as I mentioned above. It's a byte representation as opposed to an actual analog/digital representation of the music, obviously it's smaller.

But, if you read the tech post, which he didn't, you would see it gets converted to apples proprietary CAF format, which is a packet based sound format, just like MIDI. AAC is just the encoding, it's actually Apples proprietary format put in a CAF container.

I have to say, it works just fine for looped audio.. Also check out


iPhone Dev Center

This is probably better for shorter clips. I also need control over when the sound actually Stops, this soundkit gives you callbacks for when the sound objects actually stop playing!

I doubt he really even knows how to code, so at least give it a shot and try not to let negative people get ya down, or fictitious math It didn't take me that long to get the code they have working!

Quote:
Originally Posted by Kalimba View Post
Generalizing the issue to the concise bullet point of "MIDI and AAC are both sound files, so problem solved!" hardly addresses the original issue. Sure, if you want to take a 500 byte MIDI file, then "convert it" to AAC that'll work. Let's say your AAC file ends up being a megabyte, is that a realistic size for a song? Lol, I think it might be. So, great, you've effectively taken one "music" file and multiplied its size by a factor of over 2000 to get the other "music" file. But it's all just music, right? Lol. It's all the same. Problem solved. Lol. Apples are oranges as bananas are lemons. Lol. Lemonade for everyone!
marcond is offline   Reply With Quote
Old 03-04-2009, 03:57 PM   #11 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,178
Default

Quote:
Originally Posted by marcond View Post
Give it a shot guys! I'm not sure what Kalimba's problem is, I told him I wanted MIDI support too lol, not like I'm advocating AAC over MIDI. My post wasn't even for him.. Somethin about fruit I don't know.. Anyways, this does work MIDI will be much smaller, as I mentioned above. It's a byte representation as opposed to an actual analog/digital representation of the music, obviously it's smaller.

But, if you read the tech post, which he didn't, you would see it gets converted to apples proprietary CAF format, which is a packet based sound format, just like MIDI. AAC is just the encoding, it's actually Apples proprietary format put in a CAF container.

I have to say, it works just fine for looped audio.. Also check out


iPhone Dev Center

This is probably better for shorter clips. I also need control over when the sound actually Stops, this soundkit gives you callbacks for when the sound objects actually stop playing!

I doubt he really even knows how to code, so at least give it a shot and try not to let negative people get ya down, or fictitious math It didn't take me that long to get the code they have working!
Well, file this under "No Sh!t, Captain Obvious". Next time anyone needs to know how to play a music file (ANY music file, after all, they're all the same) we'll know that the solution is to make a digital sample of the "music" and then PLAY THE SAMPLE. I feel so enlightened.
Kalimba is offline   Reply With Quote
Old 03-04-2009, 04:17 PM   #12 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 15
Default

Such an ugly attitude bro, all I was trying to do was help people get on the right track... Why are you reading posts about help with audio if you already know all this.. Do you ever have anything positive to say, or are you really this ugly of a person? It is intended for people that don't know everything such as yourself!

If anyone has a REAL question, feel free to hit me up! Or ask Kimba, but he might eat your children, so watch yaself! lol
marcond is offline   Reply With Quote
Old 03-04-2009, 04:22 PM   #13 (permalink)
Pro. Game Developer
iPhone Dev SDK Supporter
 
Join Date: Feb 2009
Location: żLa Islas Hermosas?
Posts: 2,178
Default

Quote:
Originally Posted by marcond View Post
Such an ugly attitude bro ... Do you ever have anything positive to say ... are you really this ugly of a person?
...says the newbie with 5 posts dripping with attitude.
Kalimba is offline   Reply With Quote
Old 03-04-2009, 04:31 PM   #14 (permalink)
New Member
 
Join Date: Mar 2009
Posts: 15
Default

Quote:
Originally Posted by Kalimba View Post
...says the newbie with 5 posts dripping with attitude.
You're right.. from what i've read from your posts, you're always right.. I'll just drop it, i'm sorry for posting and trying to help new comers.. I will unregister from the site! sorry for the inconvenience.

Great member you got there iphonedevsdk..
marcond is offline   Reply With Quote
Old 04-25-2009, 09:03 PM   #15 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: San Diego, CA
Posts: 406
Default

I think somebody else posted asking about this recently, but I couldn't find the post. Hopefully, the other person will see this as well.

If you REALLY want to do this "from scratch", see here:

Music Acoustics, Physics, UNSW

It's a very complete web site all about musical acoustics.
jtara is offline   Reply With Quote
Old 03-15-2011, 04:27 AM   #16 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 2
Default Great work

Hello,

Nice,I am impress.

I like it musical instruments.

Thanks
Roger Britt
rogerbritt125 is offline   Reply With Quote
Old 03-17-2011, 02:20 AM   #17 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 2
Default what is percussion and drums

Hi, Nice post.

I love musical instruments.

One thing , what is percussion and drums ??


Percussion instruments can be played when struck. The sound is determined by the material of which the striking surface is made and the cavity that is left to produce the sound. Drums are excellent examples of such instruments. They are used by rock bands across the world.
rogerbritt125 is offline   Reply With Quote
Old 03-17-2011, 05:53 AM   #18 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 282
Default mobile synth open source

Have you checked this out?

mobilesynth - Synthesizer for the iPhone - Google Project Hosting
__________________
SolarSpark Apps
sparkso is offline   Reply With Quote
Old 03-17-2011, 11:20 AM   #19 (permalink)
Registered Member
 
Join Date: Mar 2011
Location: The Netherlands
Posts: 44
Default

I have a few music related projects on my github account:

https://github.com/hollance

There are classes for playing samples from a soundbank (similar to SoundFonts), for doing real-time synthesis, and so on.
Hollance is offline   Reply With Quote
Reply

Bookmarks

Tags
instruments, music, notes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 238
18 members and 220 guests
ADY, AragornSG, BrianSlick, Dani77, Dattee, dre, glenn_sayers, HemiMG, JasonR, karlam963, nobre84, Oral B, prchn4christ, Rudy, spiderguy84, themathminister, viniciusdamone, vvenkatachallam
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,884
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, karlam963
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:20 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0