17.1: Loading and Playing - p5.js Sound Tutorial

  Рет қаралды 147,235

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 206
@jan49_
@jan49_ 3 жыл бұрын
Thank you for your videos :) You reignited my passion for programming! ❤️
@shafaatkazmi4228
@shafaatkazmi4228 7 жыл бұрын
Great work boss .. i am developing a game soon it will be released but you have really helped me in making it more interactive
@edharkins112
@edharkins112 2 жыл бұрын
Amazing coder and educator!!! Thank you so much Dan!!
@huuarethey
@huuarethey 6 жыл бұрын
love you dude, really thankful for your teaching and help, have a nice day and week and year
@jrmumm
@jrmumm 3 жыл бұрын
You are awesome sir... keep doing what you're doing!
@obedotto4465
@obedotto4465 2 жыл бұрын
Man you really got that song stuck in my head!
@thalianoboalamar1710
@thalianoboalamar1710 6 жыл бұрын
You are an amazing teacher. Thank you so much.
@andrewlozano88
@andrewlozano88 8 жыл бұрын
(EDITED) LOVE YOUR WORK DAN!
@paniproduce
@paniproduce 3 жыл бұрын
Almost on every video of you i have to laugh. GOAT the nobel is a little prize for this job you doing. Thanks. A teacher from college recommended this for our digital interfaces class, and this is the most complete channel i've seen. Thanks again
@ShaXCwalk
@ShaXCwalk 7 жыл бұрын
The intro!!! Love it haha
@destinyjames6117
@destinyjames6117 4 жыл бұрын
I love this playlist!
@dbzlinkinpark99
@dbzlinkinpark99 4 жыл бұрын
could you recommend more updated p5 sound videos because I think they've changed some of the references since this video
@devpadrao6988
@devpadrao6988 4 жыл бұрын
I love yours videos. Thanks a lot!!
@sofiagarcia3581
@sofiagarcia3581 8 жыл бұрын
lol everything about this is amazing
@robinirving8307
@robinirving8307 3 жыл бұрын
Awesome video and videos!
@Shidou_san
@Shidou_san 6 жыл бұрын
how about a coding challenge: making a mp3 player with playlist and shuffle button?
@Luka1928
@Luka1928 8 жыл бұрын
LOVE YOUR VIDEO!! IT HELP ME SO MUCH
@Luka1928
@Luka1928 8 жыл бұрын
but how can i loop the song?
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
the loop() function! (instead of play())
@graxxarecords3456
@graxxarecords3456 3 жыл бұрын
WE LOVE THIS GUY! GENIOUS!
@BlockofAmethyst
@BlockofAmethyst 2 жыл бұрын
Como te quiero pa, siempre salvandome de todas 🤗
@johncerpa3782
@johncerpa3782 7 жыл бұрын
Great video
@xesigndesign
@xesigndesign 7 жыл бұрын
hello there Daniel. thank you for all the tutorials. I´m making a sketch where after 4 minuts the sketch exists or stops. i have remove(); on mousepressed, but is it possible "delay" that effect? or a simple countdown? thank you
@mauriciocedrazromero8084
@mauriciocedrazromero8084 6 жыл бұрын
Hey man, thank you so much for sharing these precious information. Just a question: How old preload and play at the same time multiple audio files? Hope you answer me! Regards!
@rohitsamineni8990
@rohitsamineni8990 4 жыл бұрын
Hey shiff,I want to simulate the log vs linear volume increment would I be able to do with js, or u recommend anything else?
@feros94
@feros94 8 жыл бұрын
I love how you dance!
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
hah, thanks!
@dbzlinkinpark99
@dbzlinkinpark99 4 жыл бұрын
@@TheCodingTrain i love the dancing too it always puts a smile on my face
@mitalisharma440
@mitalisharma440 3 жыл бұрын
thenx. vv v helpful.
@jpopperman9369
@jpopperman9369 7 жыл бұрын
I was watching this stoned and the sound panning tripped me TF out 😂
@Thespokenone
@Thespokenone 7 жыл бұрын
Is there a way to create an array and loud different sounds into that array? I've been trying to do so, but I just can't seem to get it right!
@2512kanika
@2512kanika 6 жыл бұрын
Thanks for all the amazing tutorials Dan. I can't seem to play through the console command only. especially after i use 'song.stop();' or song.pause() song.setVolume(0.3); undefined song.setVolume(0.1); undefined song.pause(); undefined song.play(); undefined this sequence doesn't play the song back again
@tyulik
@tyulik 7 жыл бұрын
can't believe i saw this earlier omg, welcome p5.js, goodbye processing minim
@elenamanrique
@elenamanrique 6 жыл бұрын
and what about preloading (or with callback) multiple audio files? I have tried but If there are two loadSound in preload only the first works (is loaded). (thanks a lot for the videos :-))
@brittl3nfriends224
@brittl3nfriends224 5 жыл бұрын
is there a way to shuffle between songs?(referring to more than 1 song you want to play )
@STLightiix
@STLightiix 5 жыл бұрын
Is there a way to change the pitch without changing the speed of an audio sample ? thank you !
@thehaptiK
@thehaptiK 3 жыл бұрын
thanks for showing us how to use the callback function. this was not covered in my class and i couldn't properly load music
@corichin2156
@corichin2156 5 жыл бұрын
How do you load more than one sound, and get the songs to alternate on mouse press?
@suomynona1937
@suomynona1937 7 жыл бұрын
Hi, I don't understand why when I use the functions seen in the video like play(), I have a deformed sound whereas when I listen to it whith Windows media Player it's ok. Is this a common mistake or a thing I forgot to initialize ?
@gregfield4457
@gregfield4457 8 жыл бұрын
panning works fine.
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
oh good!
@aadilmufti4933
@aadilmufti4933 3 жыл бұрын
Awesome video, But I have a question, so I have an express server that is getting links to MP3 files, and I want to load the audio from API calls into my p5 file, how would I do this? I can’t seem to find examples that use API calls to load audio, not a static audio file, thanks!
@Kino-Imsureq
@Kino-Imsureq 7 жыл бұрын
when i load a sound file, it just completely crashes and gives me 2 errors which i do not understand
@adefirmanfauzi5500
@adefirmanfauzi5500 4 жыл бұрын
Hmm, I got an error something like this "AudioContext error at decodeAudioData for intro.mp3 The error stack trace includes: preload"
@EtonFisch
@EtonFisch 7 жыл бұрын
Great video! I wondered how I can load a mp3 from an url, I always get the eror : "There was no response from the server at (dropboxlink) Check the url and internet connectivity. The error stack trace includes: loadSound at setup (pen.js:105:12)"
@Weckacore
@Weckacore 5 жыл бұрын
Does anyone know how to load sounds from an tag or live stream?
@barryryan5187
@barryryan5187 2 жыл бұрын
thank you thank you
@channinghurley7270
@channinghurley7270 6 жыл бұрын
Can you do the same sort of thing in Processing 3?
@HoangTran-jz4rz
@HoangTran-jz4rz 6 жыл бұрын
can i connect
@dopinkus
@dopinkus 6 жыл бұрын
Love the videos! Daniel - is it possible to use your speaker output as audio input? Basically, I want to process something I'm listening to on Spotify. Is that possible?
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
yes, but you probably need additional software for example rogueamoeba.com/loopback/. You could also just get mic input and play it loud!
@newdragon88
@newdragon88 6 жыл бұрын
Hi. I can't load mp3 file because of cors problem in windows OS. Is there any way to solve it?
@christophrenschler7650
@christophrenschler7650 7 жыл бұрын
I can't load any sound in p5.js... Every time I run the code it says: "Unable to load Quan recording.aif. The request status was: 404 (Not Found) The error stack trace includes: loadSound at preload (localhost:3000/sketch.js:4:9)" How can I fix this???
@ligavasiluna
@ligavasiluna 4 жыл бұрын
me too? :(
@elanonimatov9726
@elanonimatov9726 4 жыл бұрын
go to sketch file and then add a file which is the music I think that could solve your problem im not a expert :/
@GapIntheNap
@GapIntheNap 3 жыл бұрын
you have to declare sound format of you file use this code in preload or callback for ex soundFormats("mp3");
@birzeytindir
@birzeytindir 2 жыл бұрын
Hi, can you fix this?:(
@samclarke8724
@samclarke8724 7 жыл бұрын
anyone know where to get raw files i can link in, hosted somewhere else? like i would link in external scripts from websites etc.
@renottoner6120
@renottoner6120 4 жыл бұрын
is there any way to record audio from the same page im playing audio and export to downloadable wav/mp3? thnx
@dbzlinkinpark99
@dbzlinkinpark99 4 жыл бұрын
I think it’s possible with coding you just have go through a few more videos to find out how, but I kinda get what you mean, I can’t do it myself yet but I see that it’s possible
@gabrielaltamirano1112
@gabrielaltamirano1112 4 жыл бұрын
Is there a way the user (of the sketch) can input an audio file in real time? no mic. Uploading an audio file ?
@IsmailBuzerJamher
@IsmailBuzerJamher 7 жыл бұрын
can i use this library in my Laravel project too ?
@ankurmazumder5590
@ankurmazumder5590 5 жыл бұрын
Is the sound file being loaded to the server?
@frankanastasia9389
@frankanastasia9389 6 жыл бұрын
Hello I am trying to use this code but I cant seem to get it to do anything when I run it through nodejs any ideas?
@LynnHu
@LynnHu 6 жыл бұрын
The dances deserve more likes!
@marsproyek6987
@marsproyek6987 4 жыл бұрын
dear thank you very much... i have one quesition only little idea on android studio by sound amplifier hearing aid
@letswatchcartoons181
@letswatchcartoons181 4 жыл бұрын
your videos are awesome, could you upload a video on SoundLoop, please? Like I am trying to use SoundLoop and conditions together...
@mattkaczmarczyk6953
@mattkaczmarczyk6953 5 жыл бұрын
can't find your index.html code in github??
@mohammedabenourseddiki6860
@mohammedabenourseddiki6860 5 жыл бұрын
i have a problem i am trying to make a perfect car engine sound loop it sounds perfect on the editor but it craps at the sketch
@gracehu3031
@gracehu3031 2 жыл бұрын
I tried importing the library into the index.html file but the sound library doesn't seem to be loaded properly and I can't figure out why. Any ideas?
@seanjohnson2906
@seanjohnson2906 3 жыл бұрын
14:40 Literally reminds me of the ballroom scene music in the film "The Shining."
@jazzediceberg1175
@jazzediceberg1175 4 жыл бұрын
how can you use sound in a program which can be exported?
@danzy182
@danzy182 3 жыл бұрын
For some reason, i keep getting an error that loadSound is not defined. I checked the HTML and it links to the library fine.
@MrMelvi87
@MrMelvi87 8 жыл бұрын
Hey Daniel, thanks for making the videos. Do you have some kind of Cross Origin Request on your Chrome browser? Ive been trying this for a few hours now, even loaded a nodeJS server but i cant access the mp3 files on my folder the same way you are doing it
@MrMelvi87
@MrMelvi87 8 жыл бұрын
Fixed: github.com/processing/p5.js/wiki/Local-server
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
yes, need to run a server!
@dimitrisdimoulitsas6660
@dimitrisdimoulitsas6660 8 жыл бұрын
New Question here! Hi Daniel !! following you for years from switzerland! I have a bigger sound file to play (50mb) and I want it to start playing before it is completely loaded.. like in any web classical audio/video player there is a loading and a playing progress... is it possible?
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
this, as far as I know, is not a feature of p5 so you'd have to dig into the native web audio API.
@humming8013
@humming8013 5 жыл бұрын
i got this to work in one of my projects with a scream sound and it scared me even though i knew it was coming Edit: it dosnt stop and i cant figure how to make it stop after it starts jps.stop() wont work jps if the sounds variable
@herrbanane
@herrbanane 5 жыл бұрын
Where do I have to put the sound file?
@sleep-404
@sleep-404 7 жыл бұрын
i looooooveeeeeeee you!!!!!!!!!!!!!!!!
@mridulmishra8166
@mridulmishra8166 6 жыл бұрын
it's throwing error connecting to node.. how to resolve that??
@danmusiceasy
@danmusiceasy 3 жыл бұрын
Does anyone know how to slow down playback rate without the pitch changing?
@andrearaujodacunha7653
@andrearaujodacunha7653 2 жыл бұрын
The pan works???? That is so amazing that it makes me want to program
@ivanbezerra3531
@ivanbezerra3531 3 жыл бұрын
Hehe, love from Brazil
@accentor713
@accentor713 4 жыл бұрын
having trouble with this. Currently using the p5.js web editor to try and load a song from my desktop which doesnt work. Need to know all the software to use
@TheCodingTrain
@TheCodingTrain 4 жыл бұрын
Our Coding Train Discord is a great place to get help with coding questions ! discord.gg/hPuGy2g - The Coding Train Team
@williamaughenbaugh6886
@williamaughenbaugh6886 8 жыл бұрын
I loved that Intro, It twas amazing XD. But i was going to ask you something not relating to this video. In processing how do you make the perlin noise generator a different color and remove the stroke with out it looking like a blob
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
answered there!
@ardenchilders3618
@ardenchilders3618 Жыл бұрын
Can you load a sound into the web editor?
@elanonimatov9726
@elanonimatov9726 4 жыл бұрын
*_why don't you have more suscribers? pd: I love your dance_*
@sabyasachisamadder3612
@sabyasachisamadder3612 4 жыл бұрын
It constantly showing loading. What should I do? I am doing it on Visual Studio Code.
@rachaelconcessio3019
@rachaelconcessio3019 3 жыл бұрын
The drag modal doesn't appear for me? I'm logged in but I don't see aything
@elanonimatov9726
@elanonimatov9726 4 жыл бұрын
*_I need help pls! it says this: Unable to load boxmusic.mp3. The request status was: 404 ()_* *_can u figure out what is going on?-_* this is my code var song; function preload() { song = loadSound("boxmusic.mp3"); } function setup() { createCanvas(400, 400); song.play(); } function draw() { background(220); }
@elanonimatov9726
@elanonimatov9726 4 жыл бұрын
*_Nevermid i did it the problem was that I should go to sketch file and then add a file which is the music! I did it n_n_*
@steventrujillo8641
@steventrujillo8641 4 жыл бұрын
Sometimes my sound plays, but then sometimes it doesn't. Is this normal with html5 dev?.. Because I haven't really changed the code haha.
@objectsobjects4424
@objectsobjects4424 7 жыл бұрын
Not sure why, but every single time I try doing "song.setVolume(slider.value));", nothing wants to load onto the HTML page. When I remove it, everything works. Using the latest version of Firefox.
@andreas6508
@andreas6508 7 жыл бұрын
you mean "song.setVolume(slider.value());"
@AsaTaylor
@AsaTaylor 8 жыл бұрын
That intro music and you coming into frame has to stay. Please and thanks.
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
heh, i'm glad you enjoyed it!
@REXanadu
@REXanadu 7 жыл бұрын
Still getting 'loading...' messages for playing audio files even after following instructions on your github page. I've used both .mp3 and .wav, and nothing works.
@ruhanaazam3479
@ruhanaazam3479 6 жыл бұрын
I'm gettin this same issue, any solution?
@brettlee5382
@brettlee5382 6 жыл бұрын
Same here
@oshotz
@oshotz 6 жыл бұрын
I was having the same problem myself, but I think I've found a solution. On trying to run the code, the Developer Console that comes with Chrome spits out an error. I looked it up, and found this page here: stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local According to that, the sound file cannot be loaded due the the usage of file:// The easiest way to fix this is to use a local server, which can be done by directly using the p5.js app (open the project and hit the play button), rather than opening index.html separately. If you really wanted to, you could also host a local server using node.js, but that's not necessary.
@aaronvanderhorst6773
@aaronvanderhorst6773 5 жыл бұрын
use firefox
@dipanshuverma8819
@dipanshuverma8819 5 жыл бұрын
I get this error in Chrome and I wonder why don't you get it? Is there any way around? Access to XMLHttpRequest at __ from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. By the way, you are just amazing , watched so many of your videos and learnt so much from you.
@DarKosT12
@DarKosT12 5 жыл бұрын
I'm getting ReferenceError: loadSound in not defined every time. I simply can't load this libraries properly I suppose. I've already tried to connect them through the links and the disk. Have tried different source. The method of FLy1nRabBit stated here doesn't work either.
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Do you have p5.sound.js referenced in index.html? For more help try discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.
@DasCartoonLand
@DasCartoonLand 5 жыл бұрын
how do you get the "var" class. is it part of p5.js?
@DasCartoonLand
@DasCartoonLand 5 жыл бұрын
damn i thought you were making a tutorial for processing.... just realized that its java script
@01234567897298
@01234567897298 5 жыл бұрын
How often do you answer questions?
@nikkonikko371
@nikkonikko371 4 жыл бұрын
I recommend you to look at his discord server
@sabinesformula
@sabinesformula 8 жыл бұрын
In P5.js, can I implement youtube API and loadsound using youtube url? your tutorials are always so helpful!
@TheCodingTrain
@TheCodingTrain 8 жыл бұрын
You can use the KZbin API with p5.js yes! I don't know how easy it is to access the sound from youtube however.
@sabinesformula
@sabinesformula 8 жыл бұрын
Good to know it works! I will play around with it. Thank you!!
@verdynn5917
@verdynn5917 4 жыл бұрын
This is most likely due to a problem with the sound file's location, but the webpage only shows "loading..." and nothing else. Any suggestions?
@verdynn5917
@verdynn5917 4 жыл бұрын
These are the errors I get: p5.sound.js:819 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. goo.gl/7K7WLu Tone.Context @ p5.sound.js:819 (anonymous) @ p5.sound.js:992 (anonymous) @ p5.sound.js:997 (anonymous) @ p5.sound.js:73 (anonymous) @ p5.sound.js:74 p5.sound.js:1002 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. goo.gl/7K7WLu (anonymous) @ p5.sound.js:1002 (anonymous) @ p5.sound.js:1095 (anonymous) @ p5.sound.js:73 (anonymous) @ p5.sound.js:74 p5.sound.js:1883 Access to XMLHttpRequest at 'file:///D:/Logan/Downloads/p5/p5/empty-example/song.mp3' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. p5.SoundFile.load @ p5.sound.js:1883 p5.SoundFile @ p5.sound.js:1748 p5.loadSound @ p5.sound.js:1803 (anonymous) @ p5.js:58778 preload @ sketch.js:3 _start @ p5.js:58736 p5 @ p5.js:59080 _globalInit @ p5.js:58340 load (async) 25.../core/main @ p5.js:58353 o @ p5.js:34 (anonymous) @ p5.js:38 16../color/color_conversion @ p5.js:52829 o @ p5.js:34 r @ p5.js:51 (anonymous) @ p5.js:55 (anonymous) @ p5.js:18 (anonymous) @ p5.js:20 p5.sound.js:1880 There was no response from the server at song.mp3. Check the url and internet connectivity. The error stack trace includes: loadSound
@theboringtube
@theboringtube 2 жыл бұрын
this is what you called Fun + Learning
@michalbotor
@michalbotor 6 жыл бұрын
lol, for a split second there i thought you were snoring. ;p
@youmah25
@youmah25 7 жыл бұрын
what editor are u using if i may???
@alok1166
@alok1166 7 жыл бұрын
He is using the Atom editor
@Lyzerglick
@Lyzerglick 6 жыл бұрын
when I do this I get an error saying "loadSound is not defined", anyone know what I'm doing wrong?
@TheCodingTrain
@TheCodingTrain 6 жыл бұрын
Would you mind asking at discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.
@beaverjoe9171
@beaverjoe9171 6 жыл бұрын
try to use laodSound("bg.mp3") instead of loadSound("bg.mp3", loaded). I have same issue but i have figured out it by using above solution
@deadend8111
@deadend8111 5 жыл бұрын
yes you need to add the p5sound.js lib
@alyssamaldonado3881
@alyssamaldonado3881 4 жыл бұрын
SOS why is loadSound not being recognized it shows error "cannot find var loadSound".
@alyssamaldonado3881
@alyssamaldonado3881 4 жыл бұрын
I'm on a Macbook.
@nicolasarbio820
@nicolasarbio820 6 жыл бұрын
Daniel! Is this library available on Processing?
@nicolasarbio820
@nicolasarbio820 5 жыл бұрын
@Jonah MannOk! Thanks!
@namanmehta5243
@namanmehta5243 7 жыл бұрын
Why are there 2 sets of playlists numbered 11 i can't understand, i know it's stupid,sorry but ocd! if anyone can tell
@mathblank
@mathblank 7 жыл бұрын
One is for the p5.js(JavaScript video series - Blue text for the title) The other one is for part of the Processing(Java) video series - Orange text for the title.
@namanmehta5243
@namanmehta5243 7 жыл бұрын
got it, thanks man
@xnick_uy
@xnick_uy 3 жыл бұрын
SliderPan!! SliderPan!! Does whatever a slider can Sound to left, then to right Look out! Here comes the sliderPan!!
@darkestsunray
@darkestsunray 5 жыл бұрын
I cannot get the audio file to load for some reason. It works when I use an audio file from wikipedia, But not when I try to use other audio files.
@iFeElGoOd63
@iFeElGoOd63 5 жыл бұрын
different browsers support different types of files. The best file to go use for online programming is oftenly .ogg (these are royalty free, as opposed to mp3 files).
@darkestsunray
@darkestsunray 5 жыл бұрын
@@iFeElGoOd63 Thx for replying, I think the issue was that I needed to run a local host..
@ksbalaji1287
@ksbalaji1287 7 жыл бұрын
keep on dancin'.
@Kino-Imsureq
@Kino-Imsureq 7 жыл бұрын
i have a problem in putting it in my index.html....
@the2bestfriendstv971
@the2bestfriendstv971 3 жыл бұрын
16:21 I can hear them on my AirPods.when it is right side I hear the right side when it is left side I hear on left
17.2: Play and Pause Button - p5.js Sound Tutorial
6:16
The Coding Train
Рет қаралды 65 М.
Coding Challenge 166: ASCII Text Images
22:42
The Coding Train
Рет қаралды 1,1 МЛН
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН
哈莉奎因以为小丑不爱她了#joker #cosplay #Harriet Quinn
00:22
佐助与鸣人
Рет қаралды 9 МЛН
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 112 МЛН
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 857 М.
What is the Smallest Possible .EXE?
17:57
Inkbox
Рет қаралды 340 М.
Stop, Intel’s Already Dead!
13:47
Linus Tech Tips
Рет қаралды 370 М.
Is this my Fault?
15:41
Linus Tech Tips
Рет қаралды 2 МЛН
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 114 МЛН
Can I Run Youtube Entirely From My Terminal? (No Browser)
15:31
Coding Challenge #136.1: Polar Perlin Noise Loops
22:02
The Coding Train
Рет қаралды 194 М.
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 808 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 7 МЛН