<commit_before>---
layout: post
title: "Control music using voice"
date: 2019-04-22
description: I'm tired to search for my phone to put/change/stop music. Instead I use snips technology to control music using voice (radio, podcast, files)
categories: snips raspberrypi nodejs
image: /assets/img/music-voice-control/main-crop.jpg
ligthbox: true

---

I use a Raspberry Pi to control music in my house but the problem is that I'm
tired of looking for my phone to change the music, or change the volume or
search for a specific song. Instead I want to control my music using my voice
and I have the following concerns:

1. **I want to use Snips assistant for voice recognition**. It allows to have an
   offline voice recognition system and it has several available languages. I'm
   using an Spanish assistant, but Snips versatility allows to change the
   language assistant easily so my code can be used for different language
   assistants.

2. **Use a Bluetooth speaker**. I use a snips starter kit which includes a
   passive speaker, but sometimes I like to hear loud music but since the
   microphone is near the speaker I prefer to use a Bluetooth speaker to avoid
   interference.

3. **I want to be able to control all sources of music**. I follow podcasts but
   I also like to hear radio stations and stream music from online services
   like Soundcloud.

4. **Using javascript language for easy asynchronous code executing**. Instead
   of using python and specially python2 to control snips.

## My solution

<amp-video width="432"
  height="535"
  src="/assets/img/music-voice-control/radio.webm"
  poster="/assets/img/music-voice-control/main.jpg"
  layout="intrinsic"
  controls
  loop
  autoplay>
  <div fallback>
    <p>Your browser doesn't support HTML5 video.</p>
  </div>
</amp-video>

I will show I solve my problems:

* My code uses only javascript. I got some inspiration from the [snips
  documentation](https://docs.snips.ai/articles/console/actions/actions/code-your-action/listening-to-intents-over-mqtt-using-javascript).
  So 4 point is checked.<commit_msg>Solve AMP issue: intrinsic layout is no more valid in amp video<commit_after>---
layout: post
title: "Control music using voice"
date: 2019-04-22
description: I'm tired to search for my phone to put/change/stop music. Instead I use snips technology to control music using voice (radio, podcast, files)
categories: snips raspberrypi nodejs
image: /assets/img/music-voice-control/main-crop.jpg
ligthbox: true

---

I use a Raspberry Pi to control music in my house but the problem is that I'm
tired of looking for my phone to change the music, or change the volume or
search for a specific song. Instead I want to control my music using my voice
and I have the following concerns:

1. **I want to use Snips assistant for voice recognition**. It allows to have an
   offline voice recognition system and it has several available languages. I'm
   using an Spanish assistant, but Snips versatility allows to change the
   language assistant easily so my code can be used for different language
   assistants.

2. **Use a Bluetooth speaker**. I use a snips starter kit which includes a
   passive speaker, but sometimes I like to hear loud music but since the
   microphone is near the speaker I prefer to use a Bluetooth speaker to avoid
   interference.

3. **I want to be able to control all sources of music**. I follow podcasts but
   I also like to hear radio stations and stream music from online services
   like Soundcloud.

4. **Using javascript language for easy asynchronous code executing**. Instead
   of using python and specially python2 to control snips.

## My solution

<amp-video width="432"
  height="535"
  src="/assets/img/music-voice-control/radio.webm"
  poster="/assets/img/music-voice-control/main.jpg"
  layout="responsive"
  controls
  loop
  autoplay>
  <div fallback>
    <p>Your browser doesn't support HTML5 video.</p>
  </div>
</amp-video>

I will show I solve my problems:

* My code uses only javascript. I got some inspiration from the [snips
  documentation](https://docs.snips.ai/articles/console/actions/actions/code-your-action/listening-to-intents-over-mqtt-using-javascript).
  So 4 point is checked.
{'fraction_non_alphanumeric': 0.07124260355029585, 'fraction_numerical': 0.009940828402366864, 'mean_word_length': 3.902552204176334, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5381229', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1140, 'n_words': 576}