Shop OBEX P1 Docs P2 Docs Learn Events
Don't laugh need to make choo choo train sound with prop — Parallax Forums

Don't laugh need to make choo choo train sound with prop

mikedivmikediv Posts: 825
edited 2011-12-24 20:45 in Propeller 1
Hi guys I need some help I wired up a project for my wife she has this stupid electric train that goes around the Xmas tree, Its actually kind of cute I used a prop chip and wired up some blinking lights and stuff but she wants it to make the choo choo sound I built the circuit
with a pizeo using prop pin P0 and the Parallax Pizzeo but I have no idea how to get it to make that sound I used a PWM object and tried to tweak it but the sound is scary and really painful to the ears lol can anyone help me out it does not have to be fancy just go Choo Choo every few minutes Thank you and Happy Holidays to everyone
«1

Comments

  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-12-23 01:04
    You could cheat just a little and use Rayman's wav player from the OBEX.
    You might even get the sound to fit into memory. *maybe*

    Just Google for a suitable wav and a copy of Audacity and you'll be in business.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-12-23 01:53
    I'll bet Chip's vocal tract object could emulate a "chuff-chuff-chuff" sound really well.

    -Phil
  • mikedivmikediv Posts: 825
    edited 2009-12-23 02:03
    As always thanks guys, I am not trying to be lazy but I could use a bit more detail lol ??? Phil where can I get Chips code and OldBit that's actually a very good idea I did see a little bit about Ray's player but is it a big deal to construct?? What I have guys is a prop proto board
    it was no big deal to hook up the LEDS and Pizzeo but its just a Parallax Proto board not the demo I did wire up Video on Pins P12-P14 and the Audio I copied the Parallax Prop Demo board circuit but I do not have an SD card I could connect one if given the details OldBit wouldn't I need an SD card for Ray' Player ???? Thanks guys its really important to her and after 14 years to be honest I just do what I am told lol
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-12-23 02:14
    Mike,

    Chip's code is in the OBEX: obex.parallax.com/objects/72/

    -Phil
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-12-23 02:41
    Here's some links for what I had in mind..


    Ray's wav players (I'd use the 8bit version for this)
    obex.parallax.com/objects/324/

    Audacity (Best way to convert your wav to the proper filetype.)
    audacity.sourceforge.net/

    and of course a good source or two for train sounds. (thanks Google)
    www.grsites.com/archive/sounds/category/29/?offset=0

    If you use a small enough sound, you should be able to make it fit in memory.

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • w8anw8an Posts: 176
    edited 2009-12-23 03:39
    My first thought was also of the vocal tract. In fact, there is a program that "breathes". Bet you could speed up the breathing and it'd sound like a steam engine puffing.

    For the whistle, just run over to the local toy store and get one of those wooden train whistles you blow into. Put a small PC cooling fan at the end and fire up the fan every few moments.

    Steve
  • BaggersBaggers Posts: 3,019
    edited 2009-12-23 09:23
    What about or SIDCog? I've no idea what values to send it, but I'm sure Ahle2 should be able to assist [noparse]:D[/noparse] the SID chip used to make some great sounds on the C64 games, so should be able to do a decent train sound effect.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • AribaAriba Posts: 2,690
    edited 2009-12-23 12:46
    I was curious how easy this would be to make, so I tried it.
    Here is the result, only 30 Spin lines of code!

    Andy
  • Ahle2Ahle2 Posts: 1,179
    edited 2009-12-23 15:33
    Here is a train sound emulation using SIDcog [noparse];)[/noparse]
    With the ability to set engine speed and timing between whistles.
  • JonnyMacJonnyMac Posts: 9,186
    edited 2009-12-23 17:16
    Okay, Ahle2, that's just cool -- am going to have to find docs on your SIDcog so that I can put it to use next Halloween!
  • edited 2009-12-23 17:29
    Nothing is as realistic as recording a real steam train with bells and whistles:

    http://www.strasburgrailroad.com/
  • mikedivmikediv Posts: 825
    edited 2009-12-23 18:09
    Wow what can I Say, you guys are awesome man thank you all very much. I got side tracked last night cleaning the house I have a big Italian family and I am the oldest son so we always do a Xmas eve party at my house. I will post some pictures of the schematic and final project so you guys can see it. The train is actually pretty cool it goes around the base of the Xmas tree and little kids love it. My wife has to get every decoration you can find after Xmas. The train has to additional cars and the detail is really good, The only thing it was missing was blinking lights and sound, Evidently you can buy lights and the cho cho train sound but get this, 4 white LEDs to the extra cars $110.00 the sound device $125.00 looking in the catalog the LEDs are just that LEDs and sound board has a plug that goes into the train main car which is 12V I can not tell what's on the board from the picture but its tiny with a little piezzo speaker I suspect its like the greeting cards that play songs but for $125 bucks I could use a prop demo board and have the thing drive me to work for heaven sake LOL

    Well thank you all for the help I will post some pictures tonight happy holidays guys.
    Mike.
  • BaggersBaggers Posts: 3,019
    edited 2009-12-23 18:22
    Look forward to the pics [noparse]:)[/noparse] I told you Ahle2 and his SIDcog would come up with something good for you [noparse]:)[/noparse]

    Nice 1 Ahle2, it sounds great!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • Ahle2Ahle2 Posts: 1,179
    edited 2009-12-23 21:48
    Baggers said...
    Look forward to the pics [noparse]:)[/noparse] I told you Ahle2 and his SIDcog would come up with something good for you [noparse]:)[/noparse]
    Nice 1 Ahle2, it sounds great!
    Thanks Baggers!
    It turned out a lot better than I initially expected for a fast little hack.
    Of course I couldn't let you down(or mikedev for that matter) when you suggested to use SIDcog.

    And I almost forgot...
    Merry christmas to you mikediv and everybody else.
  • BaggersBaggers Posts: 3,019
    edited 2009-12-23 21:52
    No probs Ahle2 [noparse]:)[/noparse] I knew you'd enjoy the challenge, besides things like that is what the SID was made for [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • Ahle2Ahle2 Posts: 1,179
    edited 2009-12-24 13:19
  • DroneDrone Posts: 433
    edited 2009-12-24 14:10
    @mikdiv,

    Have a look at this little KX1400 audio playback peripheral chip (about $2 USD in unit qty, $49 for full dev-kit) from Keterex. Not sure if it can do a choo-choo sound though. Maybe not enough bandwidth. Anyway, Parallax (or Sparkfun) should make a little breakout board for this puppy - nice:

    www.keterex.com/kx1400.php

    Regards, David
  • nohabnohab Posts: 96
    edited 2009-12-25 14:17
    This is very interesting!
    I haven't played around with the sound parts of the Prop yet, can anyone tell me how to try TrainWave and/or TrainSound?
    I have a Protoboard, can I connect a pin directly to a PC-speaker or something similar?

    In my "to-do-project list" there is a wish for a·simulation of the bells at a railway crossing.
    My idea is to sample the bells into a wav-file. Use Audacity to create two wav files, with slightly lower/higher tones then the original.
    Play the wav-file with the higher tone until the train reaches the crossing, then switch to the lower-tone wav-file. Hopefulle this will sound like the Doppler-effect when passing a crossing.

    Is it doable?
    Any thoughts/ideas/suggestions?
  • Ahle2Ahle2 Posts: 1,179
    edited 2009-12-25 14:38
    Have a look at PropDemoDschem.pdf

    Just duplicate the circuit connected on pin 10 and pin 11.(You don't need the amplifier though)
  • nohabnohab Posts: 96
    edited 2009-12-25 15:41
    Thanks for rapid answer!

    So you mean that the connection to INL and INR, after the 1uF capacitor, is instead connected to the PC-speaker?
  • Ahle2Ahle2 Posts: 1,179
    edited 2009-12-25 16:19
    Ariba suggested this cirucit!
    Connect it directly to your PC speaker and enjoy.
    Pin ───────┳──────── Left out
           470Ω  10nF
    Pin ───────┼─┳────── Right out
           470Ω   │10nF
                    
    
    
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-12-26 08:00
    Hi Ahle,

    that's a really good idea to add sound to the toys.

    My son got a carrera car-racing set for christmas.

    Now: I DON'T want you to sit there for hours and fiddling around on sound details.

    ONLY if you have some C64 SID pressettings HANDY about racing cars can you post them?

    Or maybe a link to a good source for C64 sounds?

    best regards

    Stefan
  • nohabnohab Posts: 96
    edited 2009-12-26 12:55
    Thanks Ahle2 and Ariba, works just perfect!
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-12-26 17:04
    @nohab

    Just in case that circuit didn't translate on your browser.. (Didn't see it correctly here.)

    Grab a copy of the Propeller Cookbook from here:
    ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beginner.pdf

    There are a bunch of "Getting Started" Propeller circuits including the audio stuff. [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • nohabnohab Posts: 96
    edited 2009-12-26 23:17
    Thanks OBC, I have read the Cookbook earlier, for some silly reason I forgot about the audio part in it...

    The circuit wasn't translated 100% correct by the browser for me either, but together with the reference to the demo board schematic, I understood it as a 470ohm resistor in series and a 10nF cap connected to ground. I tested and it worked just fine.

    The cookbook mentions slighty different values for resistor and cap(s) but also a note that the caps can be omitted, so I guess that there is not just one correct solution but many.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2009-12-27 11:45
    Just cut and paste the funny browser circuit display to the Prop IDE to see it in its original glory. It takes me about 1/15th as long as making this post.
    666 x 189 - 14K
  • Ahle2Ahle2 Posts: 1,179
    edited 2009-12-27 14:22
    JonnyMac said...
    Okay, Ahle2, that's just cool -- am going to have to find docs on your SIDcog so that I can put it to use next Halloween!
    Thanks.
    I will make a "getting started" documentation and upload it to the SIDcog thread... it may take a while though, because it isn't a priority at the moment.
    StefanL38 said...
    Hi Ahle,

    that's a really good idea to add sound to the toys.
    My son got a carrera car-racing set for christmas.
    Now: I DON'T want you to sit there for hours and fiddling around on sound details.
    ONLY if you have some C64 SID pressettings HANDY about racing cars can you post them?
    Or maybe a link to a good source for C64 sounds?
    best regards

    Stefan
    I don't have any "pressets" sounding like a racing car.
    To be honest I don't think SIDcog whould do a very good job at sounding like a racing car.
    I will give it a try, but I will not sit for hours wink.gif
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-12-27 16:58
    Hey Ahle2, You could save yourself a lot of time by basing your instructional on the original C64
    User's Manual on the SID chip. Shouldn't be that difficult to adjust the following instructions...

    www.lemon64.com/manual/manual/8_1.html

    Change the BASIC code to SPIN, removing the requirements for POKEing the addresses. [noparse]:)[/noparse]

    I'm betting Commodore won't mind.. [noparse]:)[/noparse]


    Edit: Heck, if FemtoBASIC supported DATA statements we could add the POKE commands and
    have a C64 compatible SID in Femto..

    must...not...give...in... other...projects...to.........finish..!


    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.

    Post Edited (Oldbitcollector) : 12/27/2009 5:04:38 PM GMT
  • cgraceycgracey Posts: 14,243
    edited 2009-12-27 19:48
    Ken had this neat train whistle which was actually four whistles in one unit, and it made that lonesome train sound that we all know (at least in the USA). I looked at that sound on the spectrum analyzer I made for the speech synthesis work·and it turned out to be a C-minor-7th chord. In other words: C + Eb + G + Bb. If you could make four narrow-band resonators and excite them with white noise, you could replicate those four whistles quite nicely. The resonators in VocalTract.spin are too wide-band for that use, but you could definitely do the chug-chug sounds with it. Who knows, maybe you could set the F1-F4 resonators to those four notes and get something passable.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • JonnyMacJonnyMac Posts: 9,186
    edited 2009-12-27 20:15
    Oldbitcollector said...
    Hey Ahle2, You could save yourself a lot of time by basing your instructional on the original C64
    User's Manual on the SID chip. Shouldn't be that difficult to adjust the following instructions...

    www.lemon64.com/manual/manual/8_1.html

    Change the BASIC code to SPIN, removing the requirements for POKEing the addresses. [noparse]:)[/noparse]

    I'm betting Commodore won't mind.. [noparse]:)[/noparse]

    <snip>

    OBC

    I actually started doing that last night -- attached is a conversion of Example 1 from that manual. This file is a deliberately-direct translation so that I could get things working; once I did I started using other methods in SIDcog to make the program "cleaner."
Sign In or Register to comment.