Coder Social home page Coder Social logo

audiotheme's Introduction

Overview

AudioTheme allows you to play different types of music for whatever ocassion with visually appealing animations. It gives the user flexibility to either import their own individual music or to choose from a pre-existing music category.

Functionality

  • Users can upload mp3 files and play them from the main page
  • Users can choose from different categories to play their favorite type of music genre
  • Interactive background with music visuals based on frequency
  • Audio visuals are demonstrated through certain pitches and sounds that the music chosen produces

Wireframes

The app will consist of a play/mute button, a dropdown for the choice of two different audio themes, a file submit button that allows the user to import a music file and a dropdown for the different types of music the user can choose. The music will be rendered through in-built music options and genres.

Technologies Employed

  • Vanilla Javascript (for audio)

At first I decided to user the Web Audio API BufferLoader which would store songs in an array and then pass them along as nodes to frquencies. However, it became very difficult to integrate using vanilla javascript for the functionality of the application. This led me to explore other options. I ended up settling on using the HTML5 AudioElement which was completely flexible, intuitive and overall much cleaner and consice code. I integrated some vanilla JS and connected my music to canvas allowing me to render 2d animations.

let audio, playbtn, mutebtn, pausebtn;

     function initAudioPlayer() {
       audio = new Audio();
       audio.src = hiphop[randomHipHop];
       audio.play();

       playbtn = document.getElementById('button-play');
       mutebtn = document.getElementById('mute-button');
       pausebtn = document.getElementById('pause-button');

       playbtn.addEventListener("click", play);
       mutebtn.addEventListener("click", mute);
       pausebtn.addEventListener("click", pause);

       function play() {
         if (audio.paused) {
           audio.play();
         };
       }

       function pause() {
         if (!audio.paused) {
           audio.pause();
         };
       }

       function mute() {
         if (audio.muted) {
           audio.muted = false;
         } else {
           audio.muted = true;
         }
       }

       var source = context.createMediaElementSource(audio);
       source.connect(analyser);
       analyser.connect(context.destination);
     }
  • CSS/HTML (for visuals)

  • JS Canvas (audio frequencies)
    const canvas = document.getElementById("analyser-render");
    canvas.width = window.innerWidth - 2;
    canvas.height = window.innerHeight - 2;
    const canvasCtx = canvas.getContext("2d");
    
    canvasCtx.fillStyle = 'rgb(200, 200, 200)';
    canvasCtx.fillRect(0, 0, canvas.width, canvas.height);
    
    function draw() {
      canvasCtx.clearRect(0, 0, canvas.width, canvas.height);
      requestAnimationFrame(draw);
    
      analyser.getByteTimeDomainData(dataArray);
      analyser.getByteFrequencyData(dataArray2);
    
      canvasCtx.lineWidth = 3.15;
      function r() {
        return Math.floor(Math.random() * 255);
      }
    
      canvasCtx.strokeStyle = "rgb(" + r() + "," + 0 + "," + r() + ")";
      canvasCtx.beginPath();
      var sliceWidth = canvas.width * 1.0 / bufferLength;
      var x = 0;

Main files

  • Pick an interactive background that can be used for all different types of music
  • Be especially detailed

MVPs

  • Basic interactive visuals with an interactive homepage
  • Options different music genres which randomize songs
  • User can choose different music types/genres

Developemnt timeline

Day 1:

  • Finish branstorming ideas, create proposal.
  • Complete basic page skeleton and start doing research

Day 2:

  • Research and implementation of backgrounds for files
  • Functionality of playing music on the page

Day 3:

  • Implement the visualizations for the background
  • Visualization functionality and dropdown
  • Link to SoundCloud / import music for testing

Day 4:

  • Complete testing
  • Make sure all functinoality is good
  • Add CSS styling to missing places

Weekend:

  • Implement bonus features.
  • Deploy and check for any bugs.

Future Features may include

  • Connect the SoundCloud API to music to generate all kinds of music (future)
  • Multiple pages for different types of music (study theme)
  • Additional page for music uploading files and music rendering/bars visualization(optional)
  • User can input mp3 files through the main page
  • Functionality of allowing user to input a file to play music

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.