Git Product home page Git Product logo

smart-speaker's Introduction

Smart Speaker

    The application is a software program that enables users to play and control music on a speaker device through voice commands. The application is designed to provide a simple and intuitive interface that allows users to play music and control playback on Spotify.

    The technologies, which are used:

Setup

  1. Keep in mind that before next steps you should have Spotify client installed on your system, in case your system is Raspberry pi you should have raspotify installed (https://github.com/dtcooper/raspotify)

  2. Clone the repository

    git clone https://github.com/ABckh/Smart-Speaker.git
    
  3. Go inside cloned repository

    cd Smart-Speaker/
    
  4. Open example.properties, and you should replace everything which is in curly brackets:

      3.1   Replace {your_picovoice_access_key}, to do so:
            3.1.1.   Go to the Picovoice Console website: https://console.picovoice.ai/
            3.1.2.   If you don't have an account, click on the "Sign Up" button and create a new account. If you already have an account, log in.
            3.1.3.   Once you are logged in, you should see 'AccessKey' copy it and replace {your_picovoice_access_key} with your access key.

    picovoiceAccessKey={your_picovoice_access_key}
    

      3.2   Replace {your_platform} with one of the options: linux, mac, raspberry-pi

    porcupineKeywordPath=src/main/resources/porcupine_contexts/picovoice_{your_platform}.ppn
    
    rhinoContextPath=src/main/resources/rhino_contexts/Play-music-{your_platform}.rhn
    

      3.3 Replace {your_spotify_client_id} and {your_spotify_client_secret} with Spotify client id and Spotify client secret, to do so:
            3.3.1.   Go to the Spotify Developer Dashboard website: https://developer.spotify.com/dashboard/
            3.3.2.   Log in or sign up for a Spotify account.
            3.3.3.   Click on the "Create an App" button.
            3.3.4.   Fill in the details for your app, including its name and description.
            3.3.5.   Once you have filled in the details, click on the "Create" button.
            3.3.6.   You will now see the details of your app, including the Client ID and the Client Secret. Copy these values and paste them.

    spotifyClientId={your_spotify_client_id}
    
    spotifyClientSecret={your_spotify_client_secret}
    

      3.4   Replace {your_spotify_device_id} with your Spotify device ID, to do so:
            3.4.1.   Go to the Spotify Developer website: https://developer.spotify.com/documentation/web-api/reference/get-a-users-available-devices
            3.4.2.   Log in or sign up for a Spotify account.
            3.4.3.   Click 'Try it' button
            3.4.4.   In the 'Response' copy id of the device needed and paste it to the example.properties file

    spotifyDeviceId={your_raspotify_device_id}
    

      3.5   Replace {your_spotify_refresh_token} with Spotify refresh token, to do so:
            3.5.1.   Go to the Spotify Web API Authorization Guide website: https://developer.spotify.com/documentation/general/guides/authorization-guide/
            3.5.2.   Follow the steps to obtain an Authorization Code.
            3.5.3.   Once you have obtained the Authorization Code, use it to make a POST request to the Spotify Accounts service to obtain a Refresh Token.
            3.5.4.   The Refresh Token should be returned in the response. Copy this value and paste it in example.properties

    spotifyRefreshToken={your_spotify_refresh_token}
    
  5. Rename example.properties to config.properties

    mv example.properties config.properties
    
  6. Install all the dependencies

    mvn clean install
    mvn compile 
    
  7. Run the program:

    mvn exec:java
    

After everything is installed and the program is running, you can try it! The instruction how to use is written below!

Usage

  1. Activate Picovoice: To activate Siri, simply say "Picovoice", after that you will see this message in the console:
Wake word is detected!
  1. Give a command. All the possible commands are listed in Commands section.

  2. That's it! Smart speaker will execute your command and print a messasge about it!

Commands

Important thing about commands: slash symbol (/) means or, also everything which is in brackets is optional to say and the programm will understand the context without them!
For example:
(please) pause/stop (music)
This command means that you can say either pause or stop and you can not say please and music at all!

  • To pause playback:

    (please) pause/stop (music)
    
  • To resume playback:

    (please) continue/resume (music)
    
  • To change track to next:

    (please) (play) next (song/track)
    
  • To change track to previous:

    (please) (play) previous (song/track)
    
  • To add track to liked:

    (please) add/save (this) song/track (to liked) (please)
    
  • To remove track from liked:

    (please) remove (this) song/track (from liked) (please)
    
  • To set volume to maximum:

    (please) set volume to max/maximum (please)
    
  • To set volume to a certain percentage (you should replace { number } with two digit number):

    (please) set volume to { number } (percent)(please)
    
  • To play new music:

    This command will play 'Release Radar' playlist, which contains all new releases from your favorite artists

    (please) play (some/something) new (music)(please)
    
  • To play some random music:

    This command will play 50 newest songs from your liked shuffled

    (please) play some music
    
  • To play some random album:

    This command will play some album from your liked

    (please) play some album
    
  • To play music by genrea (you should replace { genre } with any genre):

    All possible genres are listed in slots.yml

    (please) play (some/something) (suggested) { genre } (music) (please)
    
  • To play song by artist:

    All possible artists are listed in slots.yml

    (please) play (any) song by { artist } (please)
    
  • To play album by artist:

    All possible artists are listed in slots.yml

    (please) play (any) album by { artist } (please)
    
  • To play concrete song:

    (please) play (concrete) song (by name) (please)
    

        After this command you will see this message:

    Now listening...
    

        After this message you will have 7 seconds to say the name of the song.

  • To play concrete album:

    (please) play (concrete) album (by name) (please)
    

        After this command you will see this message:

    Now listening...
    

        After this message you will have 7 seconds to say the name of the album.

Features to add

In the future I am planning to add these features:

  • Add search functionality to get information about weather and overall data from the internet
  • To add timer and alarm functionality

If you want to help, feel free to open PRs!

Pleasent use!

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.