Javascript sounds without import | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

Javascript sounds without import

I'm trying to make a game in this app using just the web languages, without importing anything. now I am wondering if i can make sounds without importing any files, I'm hoping I can somehow make like 8-bit sounds. is there a way to do anything like this? thanks for reading, if you are interested, here is my code ;) https://code.sololearn.com/WD3C1xT8rXeo/?ref=app

11th Jan 2018, 2:23 PM
wout werkman
wout werkman - avatar
20 Answers
+ 10
https://code.sololearn.com/W6tag8TitMKQ/?ref=app
11th Jan 2018, 2:37 PM
The Coding Sloth
The Coding Sloth - avatar
+ 9
THOSE ARE WONDERFUL I NEED TO CODE A WAVE ON A CANVAS!! (but I'm really lazy atm dang)
12th Jan 2018, 5:02 PM
Dapper Mink
Dapper Mink - avatar
+ 8
@The Coding Sloth, you just impressed me a lot :o I edited my previous comment by the way
11th Jan 2018, 2:41 PM
Dapper Mink
Dapper Mink - avatar
+ 8
@wout werkman If that could ever help you: https://code.sololearn.com/Ws357aromYw4/?ref=app This is awfully coded but..... but it works!! (....a bit xD)
11th Jan 2018, 4:28 PM
Dapper Mink
Dapper Mink - avatar
+ 8
congrats bro💐💐
11th Jan 2018, 4:47 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 8
What a yummy fruit *_*
12th Jan 2018, 11:46 PM
Dapper Mink
Dapper Mink - avatar
+ 7
First and foremost, let me tell you your game is incredibly good, great job!! Now, as far as I know, you can't But let's assume you manage to do it somehow, you'll then face another really annoying problem: on mobile devices, there is no way to automatically play a sound, you always need to trigger it with a click or something similar :c EDIT: Ok I was completely wrong, my bad @The Coding Sloth just showed me something wonderful which I can't way to play with
11th Jan 2018, 2:38 PM
Dapper Mink
Dapper Mink - avatar
+ 7
@QuentinJanuel, that's what I thought until I found that solution.
11th Jan 2018, 2:39 PM
The Coding Sloth
The Coding Sloth - avatar
+ 7
You highly deserved it!! By the way I am making a music with the oscillator since I read The Coding Sloth's comment! This is so much fun ^^
11th Jan 2018, 3:52 PM
Dapper Mink
Dapper Mink - avatar
+ 7
Audio runs on an asynchronous thread, the significance of which can be easy to miss. Three of these try to time sound interactions, especially where it's crucial (like morse); the other uses beat frequency / interference. Spent some time on an audio illusion: https://code.sololearn.com/W7jLtnVBmTyo/?ref=app Midi reference, trying to coordinate with vibrate: https://code.sololearn.com/Wfzu19163vr8/?ref=app Simpler object setup (warbling / beat frequency): https://code.sololearn.com/WtQNPJWBm54i/?ref=app Morse (note: auto start) https://code.sololearn.com/WhA0089E477F/?ref=app
12th Jan 2018, 4:41 PM
Kirk Schafer
Kirk Schafer - avatar
+ 7
Please keep in mind you are not COTD because of us but only thanks to the wonderful quality of your code! The Coding Sloth solved your problem but I personnally don't deserve any thank at all, I'm just really glad I went to discover your content (and the JS oscillator, oh god that feature is pure gold) Thank you also for being such a nice person in the Q&A section, you are a real breath of fresh air. I wish you the best with your code! Me :)
12th Jan 2018, 7:42 PM
Dapper Mink
Dapper Mink - avatar
+ 7
I'm just going to sit here and smile happily for a little bit :)
13th Jan 2018, 3:22 PM
Kirk Schafer
Kirk Schafer - avatar
+ 6
@The Coding Sloth this is truly amazing! I'm looking forward to working this out!
11th Jan 2018, 2:46 PM
wout werkman
wout werkman - avatar
+ 6
thanks all, now that I have all this information, and I finally made my code working for almost all the devices, I can focus on the sounds... if I'm done moving to amsterdam this weekend, had little spare time because of preparations @The Coding Sloth @QuentinJanuel thanks for kick-starting my code's popularity and somehow magically making it COTD. I learned so much from the feedback I got from COTD, it has been an eye opening experience, and it made me much more secure about my programming, @Kirk Schafer Thanks for your great and thorough response, and very detailed explanations, your work and knowledge has been based on a solid base of knowledge and research, I learned allot from your feedback one day I will know how to, and be able to thank you much respect, me ;)
12th Jan 2018, 6:29 PM
wout werkman
wout werkman - avatar
+ 6
Wow; All I really hope for is that you're interested in more and explore whatever inspirations speak to you. Thanks for the kind words, by which I mean: It's nice to see people talking like this with each other. @Everyone here, I hope your ideas keep bearing fruit.
12th Jan 2018, 7:48 PM
Kirk Schafer
Kirk Schafer - avatar
+ 6
@Kirk Shafer, fruits like this one? https://code.sololearn.com/WObgZYrOTd4d/?ref=app
12th Jan 2018, 11:37 PM
The Coding Sloth
The Coding Sloth - avatar
+ 6
https://code.sololearn.com/WIvV3u3E0s6B/?ref=app
15th Mar 2018, 1:00 PM
Prashanth Kumar
Prashanth Kumar - avatar
+ 5
thanks guys, I don't know how, but I'm pretty sure my code became COTD because of you ;)
11th Jan 2018, 3:49 PM
wout werkman
wout werkman - avatar
+ 4
Making sounds with Webaudio is the simple part, the harder part is chaining sounds to make a melody. Now it's definitely doable - you have to write a scheduler - but a bit tricky. The simplest library I have found yet (and I'm looking so let me know if you know any) that could be used for that purpose is beet.js, maybe you can give that a try. http://zya.github.io/beet.js/
11th Jan 2018, 2:48 PM
Schindlabua
Schindlabua - avatar
+ 3
wow I actually enjoy myself 10/10 for me
11th Jan 2018, 3:17 PM
Jason Rose
Jason Rose - avatar