Arduino Forum

Using Arduino => Audio => Topic started by: Vindhyachal_Takniki on Aug 21, 2016, 08:43 pm

Title: What are Pitch & Tone in music/microcontroller
Post by: Vindhyachal_Takniki on Aug 21, 2016, 08:43 pm
I have to play music through microcontroller. There is requriement to change the pitch & tone of the music. Actually there are two push button for this, one for music & other for tone.
I dont know what these two buttons actually do? What there function actually?
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: DVDdoug on Aug 21, 2016, 10:27 pm
Pitch is the perception of frequency (high notes & low notes).   A kitty cat makes a high-pitched sound and tiger makes a low-pitch.


Tone can mean a lot of different things but it's probably the tembre/character of the sound...  That's the overtones & harmonics that make a piano sound different from a trumpet when they are playing the same note, or it's what makes two different singers sound different when singing the same song and the same notes.   
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: Grumpy_Mike on Aug 22, 2016, 08:25 am
Quote
I have to play music through microcontroller.
Is this some sort of assignment?

Quote
. Actually there are two push button for this, one for music & other for tone
So are you saying you have a micro controller wired up with two buttons but you don't know how they are wired up? Is this micro controller an Arduino? If so what sort?

Are you wanting to change the pitch of the music without changing the speed?
Where is this music coming from? An internal SD card or an audio source?
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: Vindhyachal_Takniki on Aug 23, 2016, 10:06 am
I have asked question in wrong way. Let me rephrase it.

I have a musical instrument from a company in front of me, I have to make my own. Inside it, it has some ic, but all part numbers are erased.
Its a musical instrument which play stored music basically. It has option to control: volume, pitch & tone of music.

I have no such experiene in playing music. I want to know where to begin with??
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: Grumpy_Mike on Aug 23, 2016, 12:05 pm
Quote
I want to know where to begin
I would have thought with posting a picture of your instrument.
Then say what you want to do.
Do you want to change that instrument in some way?
Do you want to make something like that instrument using an Arduino?
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: Vindhyachal_Takniki on Aug 23, 2016, 12:49 pm
1. I want to make instrument as it is
2. Either with arduino or any other mcu from AVR.

Title: Re: What are Pitch & Tone in music/microcontroller
Post by: pjrc on Aug 23, 2016, 04:51 pm
Let me see if I understand... you want us to assist you to make a copy (knock off) of some company's product.

You also want us to spend our time guessing what that product is, what it does, how it sounds, etc?  Better we waste our time, than you invest the effort to share photos & video...
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: DVDdoug on Aug 23, 2016, 05:00 pm
The Arduino can make some simple sounds...  Square waves & rectangle waves.   It's going to sound electronic/synthesized and it's difficult to play more than one note at a time.    Try out the tone() function and the Play melody (https://www.arduino.cc/en/Tutorial/PlayMelody[/quote) to see what kind of sounds you can get.

Or, if you don't know what a square wave sounds like, download Audacity (http://www.audacityteam.org/).  It can generate "tones" (square waves, sine waves, etc.) that you can play on your computer.    And if you want to take the time, you can look-up the frequencies for various notes and generate a sequence of tones to play a melody.

It's going to take additional hardware to make anything that sounds like a real musical instrument.   And since the Arduino doesn't have a DAC, there's no way to get dynamics or generate ADSR (https://en.wikipedia.org/wiki/Synthesizer#Attack_Decay_Sustain_Release_.28ADSR.29_envelope).

(I don't know how modern keyboards are made...  I haven't seen a schematic or block diagram for a keyboard...  I assume it looks a lot like a computer with the addition of keys and maybe a DSP chip.)

Quote
1. I want to make instrument as it is
Is is broken or are you trying to duplicate it?

Either way, it's probably going to be impossible since you don't know what's inside and you don't know what waveforms are produced.   

You may be able to make something similar, but it's going to sound different.
 

And of course, it's impossible for us to help you because we have no idea what you've got.

Title: Re: What are Pitch & Tone in music/microcontroller
Post by: CrossRoads on Aug 23, 2016, 05:52 pm
You can make a simple organ like keyboard. '1284P is good for that, 13 'keys' and 13 simultaneous outputs.
Youtube demo, output playing on self-powered computer speakers from a retired desktop.
https://www.youtube.com/watch?v=4c8idXN4Pg0 (https://www.youtube.com/watch?v=4c8idXN4Pg0)
Arduino topic on it.
http://forum.arduino.cc/index.php?topic=179761.0 (http://forum.arduino.cc/index.php?topic=179761.0)
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: CrossRoads on Aug 23, 2016, 06:00 pm
With a little filtering, you can make the simple square waves have other timbres as well.
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: pjrc on Aug 23, 2016, 09:59 pm
It's going to take additional hardware to make anything that sounds like a real musical instrument.   And since the Arduino doesn't have a DAC, there's no way to get dynamics or generate ADSR (https://en.wikipedia.org/wiki/Synthesizer#Attack_Decay_Sustain_Release_.28ADSR.29_envelope).
Indeed options for quality sound are quite limited on Arduino Uno.

But if you step up to more powerful ARM-based boards which also have real DAC pins, so much more becomes possible.  I recently launched a kickstarter for a couple much more powerful boards (https://www.kickstarter.com/projects/paulstoffregen/teensy-35-and-36).  In the video on that page, I did a demo where a sketch synthesizes 6 guitar strings.  It's all CD quality 44.1kHz 16 bit sound.  This uses only 7.7% of the CPU power of that board to simulate all 6 and mix and play them to the DAC pin.  The sound demo begins about 1 minute into the video, if you'd like to skip past the talk about the products.
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: Grumpy_Mike on Aug 25, 2016, 06:25 am
Quote
I recently launched a kickstarter for a couple much more powerful boards. 
Looks cool, just backed it.
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: pjrc on Aug 25, 2016, 01:30 pm
Thanks  :)

If you're planning any more DIY audio books, maybe we could collaborate next year on some DSP material?  180 MHz with the M4's DSP extensions is going to make possible things that have been unimaginable on microcontrollers... like a phase vocoder for real-time pitch shifting!
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: Vindhyachal_Takniki on Aug 30, 2016, 07:07 am
This is the device.
https://www.youtube.com/watch?v=CQ6iELAiGDQ

Which audio IC/mCU to use??
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: Grumpy_Mike on Aug 30, 2016, 02:36 pm
Please google:-

Electroinic Tanpura project

There are lots of designs to chose from. I found this one from the first hit:-
Electric Tanpura (https://books.google.co.uk/books?id=AnUTQ4FT25sC&pg=PA85&source=gbs_toc_r&cad=4#v=onepage&q&f=false)
Title: Re: What are Pitch & Tone in music/microcontroller
Post by: ChrisTenone on Aug 30, 2016, 08:41 pm
This is the device.
https://www.youtube.com/watch?v=CQ6iELAiGDQ

Which audio IC/mCU to use??
Based on your video, it appears the device has a custom sound chip that would be difficult if not impossible for an Arduino to reproduce.