Shop OBEX P1 Docs P2 Docs Learn Events
Unable to play wav files(solved) — Parallax Forums

Unable to play wav files(solved)

msiriwardenamsiriwardena Posts: 301
edited 2019-03-15 17:01 in Learn with BlocklyProp
I have the BlocklyProp program loaded into Activity board WX and it will not play songs.
The same setup will play when I use a spin program.

I tried attaching an empty If forever block - failed to play
I attached the initializing block - failed to play
I have a blinky for ever program with wav play - failed

I have attached one of the failed blockly programs.

I need help to get the wav player started.

Siri

Comments

  • If I am reading the blocks correctly, the program is making pin 11 high for 500ms and then low for 500ms and the repeating that forever. The program never gets to the "WAV play file" block.

    Tom
  • @Tom,
    I re-arranged the blocks and still does not work.
    The wav block - starts a new cog and runs the wav files.
    According to the instructions if playing only wav files and no other blocks, place an empty if forever block
    after the wav block, but none of them works.

    Tom thanks for your suggestion but I wonder where
    the blocklyprop Gurus are when we need help.

    I have another post with no suggested answers.
    The prop1 community is extremely helpful.I had answers within hours for my issues.

    Siri
  • Siri,

    You'll need to carefully format the wav file according to this tutorial: http://learn.parallax.com/support/reference/sound-library/formatting-audio-files-wav-players

    Have you done that already?

    Ken Gracey
  • @Ken Gracey

    The wav files were formatted using Audacity with the directions.

    Siri
  • msiriwardenamsiriwardena Posts: 301
    edited 2019-03-12 16:23
    @KenGracey

    Not only these wav files formatted using Audacity, they play in Andy's Juke Bot -which I still have and is working.

    This reference is to the spin Juke Bot by Andy

    Siri
  • Can you post or e-mail me your wav file to kgracey@parallax.com? If it's really big, use a file transfer system.

    In the meantime, can you verify that you've got a set_volume block in your code? Speaker is charged too?

    I can hook this up and try it myself in two hours.

    Thanks,

    Ken Gracey
  • msiriwardenamsiriwardena Posts: 301
    edited 2019-03-12 17:14
    @"Ken Gracey"

    This not a big program, I was trying to play wav songs before I add music to a program.

    I have posted a screen shot in the original post.I have tried with set_volume block,I have
    tried with the initializing block,tried with a blank "IF for ever" block to the end,Itried with
    along pause(90000)block. None worked.

    Initially with the "Juke box Bot" the wav files did not play and after some research "Ariba'
    had a solution " to make the titles short, and it worked and the titles are only one word long.

    When you get it to work please attach a screen sot of the solution to the issue.

    Thank you for your help.

    Siri
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2019-03-12 19:54
    There's a subtle necessity about using the wav file playback blocks.

    Please see this http://learn.parallax.com/support/reference/propeller-blocklyprop-block-reference/audio and note that the code launched by the wav playback block starts another processor. The main processor must continue running for at least part of the duration of the wav file, else you'll get a buzzing sound when the main processor stops.

    Here is an example of a project that works, because of the PAUSE 5000 block being present after the wav playback block.

    http://blockly.parallax.com/blockly/editor/blocklyc.jsp?project=86767#

    Screen%20Shot%202019-03-12%20at%2012.52.30%20PM.png
    // ------ Libraries and Definitions ------
    #include "simpletools.h"
    #include "wavplayer.h"
    
    
    
    // ------ Main Program ------
    int main() {
      sd_mount(22, 23, 24, 25);
      wav_volume(7);
      wav_play("techloop.wav");
      pause(5000);
      wav_stop();
    }
    

    Maybe start with this, using the techloop.wav file on our web site and see if you can get it to work.

    Also, I asked if you'd send me your wav file so I could check it too.

    Thanks,

    Ken Gracey
  • @"Ken Gracey"

    This not a big program, I was trying to play wav songs before I add music to a program.

    I have posted a screen shot in the original post.I have tried with set_volume block,I have
    tried with the initializing block,tried with a blank "IF for ever" block to the end,Itried with
    along pause(90000)block. None worked.

    Initially with the "Juke box Bot" the wav files did not play and after some research "Ariba'
    had a solution " to make the titles short, and it worked and the titles are only one word long.

    When you get it to work please attach a screen sot of the solution to the issue.

    Thank you for your help.

    Siri

    Could you include the .WAV file so we came check on our platforms?
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2019-03-12 20:43
    The Parallax files are right here http://learn.parallax.com/support/reference/sound-library and I'd also like to try Siri's file for compatibility and output format.

    Ken Gracey
  • msiriwardenamsiriwardena Posts: 301
    edited 2019-03-12 22:16
    @"Ken Gracey" ,@Publison

    Here are the wav files I was trying play.

    Thanks for all your help,

    Siri
  • @Ken Gracey,@Publison

    I am uploading the file again as I was not sure whether
    they were uploaded. This is a Zip file.

    Siri
  • PublisonPublison Posts: 12,366
    edited 2019-03-12 22:21
    @Ken Gracey,@Publison

    I am uploading the file again as I was not sure whether
    they were uploaded. This is a Zip file.

    Siri

    Use the "Attach" function to include your ZIP file.
  • @Publison

    I will try again , I used attach file before too

    Siri

    I tried using a single song and as well as zip file ,when I
    attach it it shows uploading bot nothing else happen.
    ? is there something wrong with the site. I have uploaded files before and
    they show at the bottom before I click "post Comment"

    Please check whether the site is functioning?

    Thank you

    Siri
  • PublisonPublison Posts: 12,366
    edited 2019-03-12 23:32
    @Publison

    I will try again , I used attach file before too

    Siri

    I tried using a single song and as well as zip file ,when I
    attach it it shows uploading bot nothing else happen.
    ? is there something wrong with the site. I have uploaded files before and
    they show at the bottom before I click "post Comment"

    Please check whether the site is functioning?

    Thank you

    Siri

    For some reason .WAV files are not supported now. They have been supported in the past.
    I will put a ticket to Parallax about the problem.
    In the mean time, if you can ZIP the .WAV file up, that should upload.

    EDIT: The site does not accept .mp3 files any more. We will get it fixed tomorrow.
  • Siri, were you able to run the test I suggested, using my code posted above and a Parallax-formatted wav file as an example?

    This could probably tell us several things:

    - whether the formatting of your wav files is a problem
    - any issues with your speaker or SD card

    I really suggest you start there. In the meantime, e-mail me your wav file (kgracey@parallax.com) as suggested above. Then, we can help you quite a bit more.

    Ken Gracey
  • @"Ken Gracey"

    I tried your blocks to play a song and it failed.

    All I hear is a click from the VHO speaker.


    Siri
  • @Publison

    I am trying again to upload the files and

    I am using chrome , other times I used windows explorer.

    I hope it will work.

    Siri

  • @Publison

    I can play files in SD card on my computer but
    When I up load the filed a notification appears
    on the left panel "no file data could be found in your post"

    Siri
  • @Publison

    I can play files in SD card on my computer but
    When I up load the filed a notification appears
    on the left panel "no file data could be found in your post"

    Siri

    It's possible that the SD card has not been formatted properly because the error you describe sounds like something Windows would display when you copy files to an SD card. But in a prior post you indicated this SD card was used in the JukeBot application where it played files back from Spin code. Do I understand correctly?

    Is the SD card from Parallax? We format ours and test them to work.

    Can you e-mail (kgracey@parallax.com) one of the files you are trying to play?

    Ken Gracey
  • @"Ken Gracey"

    I e-mailed the songs and I hope you got them.

    Siri
  • Got the files and David Carrier is looking at them for us (I don't have hardware handy).

    Will report back.

    Ken Gracey
  • Siri, we checked your wav files today and found that the sample rate was off, but the format was correct. This would likely cause the library to play a "click". The wav file creation must follow our instructions exactly. https://learn.parallax.com/reference/create-audio-files-wav-players. Any deviation will cause the file not to play back (at least with the library we are using).

    For this reason, I suggested that you eliminate the speaker/SD card/file formats as the problem by using a wav file created by Parallax available from our library https://learn.parallax.com/support/reference/sound-library

    When things don't work right, back up a bit. Remove unknowns and simplify.

    Ken Gracey
  • See this too - it's exactly what you're trying to do from Whit:



    Ken Gracey
  • @"Ken Gracey"

    I will follow all the advice you have given.I will

    I will do that to-morrow.

    Thank you very much for all the help.


    Siri
  • msiriwardenamsiriwardena Posts: 301
    edited 2019-03-14 13:29
    @"Ken Gracey"
    Ken,
    Your solution worked well, only mistake I\I
    made was my pause was too short , so it played
    few notes then I realized the issue.

    Thanks a lot helping me

    Siri

Sign In or Register to comment.