Mycroft/Mopidy setup

I found what appears to be a typo in the mycroft/mopidy setup
The mycroft.conf file delimiter is a : but the doc is referencing an equal sign

See this web url link for the type in the delimiter…

and refernce the area below.
Mycroft Setup
Mycroft needs to be pointed to the mopidy server. Add the following to ~/.mycroft/mycroft.conf for a local mopidy server at the default port:
“Mopidy Skill”: {
“mopidy_url” = “http://localhost:6680
}

1 Like

Opps that was suppost to be typo not type.

:wink:

Now that I have mopidy and mycroft working well on my Ubuntu desk top I intend to get my raspberry pi 3 working.

For reference here are my python modules for mopidy

:~/.config/pulse$ pip list |grep Mopidy
Mopidy (2.1.0)
Mopidy-API-Explorer (1.0.1)
Mopidy-Local-SQLite (1.0.0)
Mopidy-MusicBox-Webclient (2.4.0)
Mopidy-TuneIn (0.4.1)

Here is my ubuntu mopidy.conf

~/.config/mopidy$ cat mopidy.conf

For further information about options in this file see:

http://docs.mopidy.com/

The initial commented out values reflect the defaults as of:

Mopidy 0.17.0

Mopidy-HTTP 0.17.0

Mopidy-Local 0.17.0

Mopidy-MPD 0.17.0

Mopidy-Stream 0.17.0

Available options and defaults might have changed since then,

run mopidy config to see the current effective config and

mopidy --version to check the current version.

This config is tested and running Sept 10, 2017 Todd

[logging]
#console_format = %(levelname)-8s %(message)s
#debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s
#debug_file = mopidy.log
#config_file =

[loglevels]
#cherrypy = warning
#pykka = info

[audio]
#mixer = software
#mixer_track =
#output = autoaudiosink
#visualizer =

[proxy]
#scheme =
#hostname =
#port =
#username =
#password =

[http]
enabled = true
hostname = 0.0.0.0
port = 6680
#static_dir =
zeroconf = Mopidy HTTP server on $hostname

[local-sqlite]
enabled = true
directories =
Albums local:directory?type=album
Artists local:directory?type=artist
Composers local:directory?type=artist&role=composer
Genres local:directory?type=genre
Performers local:directory?type=artist&role=performer
Release Years local:directory?type=date&format=%25Y
Tracks local:directory?type=track
Last Week’s Updates local:directory?max-age=604800
Last Month’s Updates local:directory?max-age=2592000

database connection timeout in seconds

timeout = 10

whether to use an album’s musicbrainz_id for generating its URI

use_album_mbid_uri = true

whether to use an artist’s musicbrainz_id for generating its URI;

disabled by default, since some taggers do not handle this well for

multi-artist tracks [https://github.com/sampsyo/beets/issues/907]

use_artist_mbid_uri = false

whether to use the sortname field for sorting artist browse results;

set to false to sort according to displayed name only

use_artist_sortname = true

[mpd]
#enabled = true
#hostname = 0.0.0.0
#port = 6600
#password =
#max_connections = 20
#connection_timeout = 60
#zeroconf = Mopidy MPD server on $hostname

[local]
library = sqlite
#library = json
scan_flush_threshold = 100
enabled = true
media_dir = /media/legtod2/5tb/Music
#media_dir = /home/legtod2/Music
#playlists_dir = $XDG_DATA_DIR/mopidy/local/playlists
#tag_cache_file = $XDG_DATA_DIR/mopidy/local/tag_cache
scan_timeout = 1000
excluded_file_extensions =
.html
.jpeg
.jpg
.log
.nfo
.png
.txt
.ini
.pls
.aspx

[file]
enabled = false
media_dirs =
$XDG_MUSIC_DIR|Music
~/|Home
excluded_file_extensions =
.jpg
.jpeg
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

[stream]
#enabled = true
#protocols =

file

http

https

mms

rtmp

rtmps

rtsp

[spotify]
username = legtod2
password =

Here is my ubuntu mycroft.conf

:~/mycroft-core-dev/mycroft/configuration$ cat mycroft.conf
{
// Definition and documentation of all variables used by mycroft-core.
//
// Settings seen here are considered DEFAULT. Settings can also be
// overridden at the REMOTE level (set by the user via
// https://home.mycroft.ai), at the SYSTEM level (typically in the file
// ‘/etc/mycroft/mycroft.conf’), or at the USER level (typically in the
// file ‘~/.mycroft/mycroft.conf’).
//
// The Override: comment indicates at what level (if any) this is
// overridden by the system to a value besides the default shown here.

// Language used for speech-to-text and text-to-speech.
// Code is a BCP-47 identifier (https://tools.ietf.org/html/bcp47), lowercased
// TODO: save unmodified, lowercase upon demand
// Override: none
"lang": “en-us”,

// Measurement units, either ‘metric’ or ‘english’
// Override: REMOTE
"system_unit": “metric”,

// Time format, either ‘half’ (e.g. “11:37 pm”) or ‘full’ (e.g. “23:37”)
// Override: REMOTE
"time_format": “half”,

// Date format, either ‘MDY’ (e.g. “11-29-1978”) or ‘DMY’ (e.g. “29-11-1978”)
// Override: REMOTE
"date_format": “MDY”,

// Play a beep when system begins to listen?
// Override: none
"confirm_listening": true,

// File locations of sounds to play for system events
// Override: none
"sounds": {
“start_listening”: “snd/start_listening.wav”,
“end_listening”: “snd/end_listening.wav”
},

// Mechanism used to play WAV audio files
// Override: SYSTEM
"play_wav_cmdline": “paplay %1 --stream-name=mycroft-voice”,

// Mechanism used to play MP3 audio files
// Override: SYSTEM
"play_mp3_cmdline": “mpg123 %1”,

// Location where the system resides
// NOTE: Although this is set here, an Enclosure can override the value.
// For example a mycroft-core running in a car could use the GPS.
// Override: REMOTE
"location": {
“city”: {
“code”: “Lawrence”,
“name”: “Lawrence”,
“state”: {
“code”: “KS”,
“name”: “Kansas”,
“country”: {
“code”: “US”,
“name”: “United States”
}
}
},
“coordinate”: {
“latitude”: 38.971669,
“longitude”: -95.23525
},
“timezone”: {
“code”: “America/Chicago”,
“name”: “Central Standard Time”,
“dstOffset”: 3600000,
“offset”: -21600000
}
},

// General skill values
// Override: none
"skills": {
// Directory to look for user skills
"directory": “~/.mycroft/skills”,
// TODO: Old unused kludge, remove from code
"stop_threshold": 2.0,
// blacklisted skills to not load
"blacklisted_skills": [“skill-media”, “send_sms”, “skill-wolfram-alpha”]
},

// Address of the REMOTE server
// Override: none
"server": {
“url”: “https://api.mycroft.ai”,
“version”: “v1”,
“update”: true,
“metrics”: false
},

// The mycroft-core messagebus’ websocket
// Override: none
"websocket": {
“host”: “0.0.0.0”,
“port”: 8181,
“route”: “/core”,
“ssl”: false
},

// Settings used by the wake-up-word listener
// Override: REMOTE
"listener": {
“sample_rate”: 16000,
“channels”: 1,
“record_wake_words”: false,
“wake_word”: “hey mycroft”,
“phonemes”: “HH EY . M AY K R AO F T”,
“phoneme_duration”: 120,
“threshold”: 1e-90,
“multiplier”: 1.0,
“energy_ratio”: 1.5
},

// Mark 1 enclosure settings
// Override: SYSTEM (e.g. Picroft)
“enclosure”: {
// Platform name (e.g. ‘Picroft’, ‘Mark_1’
// Override: SYSTEM (set by specific enclosures)
# “platform”: “picroft”,

// COMM params to the Arduino/faceplate
"port": "/dev/ttyAMA0",
"rate": 9600,
"timeout": 5.0,

// ??
"update": true,

// Run a self test at bootup?
"test": false

},

// Level of logs to store, one of “CRITICAL”, “ERROR”, “WARNGIN”, “INFO”, “DEBUG”
// Override: none
"log_level": “DEBUG”,

// Messagebus types that will NOT be output to logs
// Override: none
"ignore_logs": [“enclosure.mouth.viseme”],

// Settings related to remote sessions
// Overrride: none
"session": {
// Time To Live, in seconds
"ttl": 180
},

// Speech to Text parameters
// Override: REMOTE
"stt": {
// Engine. Options: “mycroft”, “google”, “wit”, “ibm”, “kaldi”
“module”: “mycroft”
// “kaldi”: {
// “uri”: “http://localhost:8080/client/dynamic/recognize
// }
},

// Text to Speech parameters
// Override: REMOTE
"tts": {
// Engine. Options: “mimic”, “google”, “marytts”, “fatts”, “espeak”, “spdsay”
“module”: “mimic”,
“mimic”: {
“voice”: “ap”
},
“espeak”: {
“lang”: “english-us”,
“voice”: “m1”
}
},
“Mopidy Skill”: {
“mopidy_url”: “http://localhost:6680
},

// =================================================================
// All of the follow are specific to particular skills and will soon
// be removed from this file.
// =================================================================

“wifi”: {
“setup”: false
},
“ConfigurationSkill”: {
“max_delay”: 60
},
“WikipediaSkill”: {
“max_results”: 5,
“max_phrases”: 2
},
“WolframAlphaSkill”: {
“api_key”: “”,
“proxy”: true
},
“WeatherSkill”: {
“api_key”: “”,
“proxy”: true,
“temperature”: “fahrenheit”
},
“NPRNewsSkill”: {
“url_rss”: “http://www.npr.org/rss/podcast.php?id=500005
},
“AlarmSkill”: {
“filename”: “alarm.mp3”,
“max_delay”: 600,
“repeat_time”: 20,
“extended_delay”: 60
},
“ReminderSkill”: {
“max_delay”: 600,
“repeat_time”: 60,
“extended_delay”: 60
},
“VolumeSkill”: {
“default_level”: 6,
“min_volume”: 0,
“max_volume”: 100
},
“AudioRecordSkill”: {
“filename”: “/tmp/mycroft-recording.wav”,
“free_disk”: 100,
“max_time”: 600,
“notify_delay”: 5,
“rate”: 16000,
“channels”: 1
},
“SkillInstallerSkill”: {
},
“Audio”: {
“backends”: {
“local”: {
“type”: “mpg123”,
“active”: true
},
“vlc”: {
“type”: “vlc”,
“active”: true
}
},
“default-backend”: “local”
}
}

Here are my installed mycroft skills locate in /opt/mycroft/skills folder

~$ ls /opt/mycroft/skills/
fallback-wolfram-alpha skill-installer skill-reminder
mopidy_skill skill-ip skill-singing
mycroft-skill-cbc-news skill-joke skill-speak
mycroft-youtube skill-mark1-demo skill-spelling
skill-alarm skill-media skill-stock
skill-audio-record skill-naptime skill-stop
skill-configuration skill-npr-news skill-volume
skill-date-time skill-pairing skill-weather
skill-desktop-launcher skill-personal skill-wiki
skill-hello-world skill-playback-control TranslateSkill

mopidy notes:

Using sqlite data base for my 3000+ songs.

Examples:
Hey mycroft, play some rock music. # This builds a queue of all songs from genre Rock
To view results of my search I point my browser to
http://localhost:6680/musicbox_webclient/index.html#current
Alternatively I could say
Hey mycroft, play Boston
This will load the queue with my tracks from boston

To play the next song in the queue
Hey mycroft, play next track
or
Hey mycroft, play previous track

To pause
Hey mycroft, pause track,

Hey mycroft, what is currently playing?
Hey mycroft, resume track.

Hey mycroft, play boston.
Hey mycroft, play Abba.

Ok you get the picture of testing

I am not running mopidy as a service

cd ~
mopidy local clear # Respond y to clear my data base. Only need to do this one time
mopidy local scan # If necessary can have a weekly or monthly cron job to load my new songs
mopidy -v -v # Adding -v is really not necessary. I use it for debug

after mopidy is running I open a second terminal session on my desktop

cd ~/mycroft-dev-core
./mycroft.sh start
tail -f scripts/logs/mycroft-skills.log

This lets me see whats happening from a debug standpoint on mycroft logs and mopidy logs

Command line testing is mycroft working

cd ~/mycroft-dev-core
./start.sh cli

Input:
What time is it
Tell me a joke
Search Wikipedia for Terry Fox
What is my ip address
Search youtube for plush
close firefox
play some rock music
pause track
what is currently playing

Here is my pulseaudio setup. I am not running it as a daemon

~/mycroft-core-dev$ ps -ef |grep pulse
mpd 1425 1 0 11:31 ? 00:00:00 /usr/bin/pulseaudio --start --log-target=syslog
legtod2 3682 3365 1 11:34 ? 00:02:13 /usr/bin/pulseaudio --start --log-target=syslog

~/mycroft-core-dev$ pulseaudio --dump-conf

Read from configuration file: /etc/pulse/daemon.conf

daemonize = no
fail = yes
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
allow-module-loading = yes
allow-exit = yes
use-pid-file = yes
system-instance = no
local-server-type = user
cpu-limit = no
enable-shm = yes
flat-volumes = no
lock-memory = no
exit-idle-time = 20
scache-idle-time = 20
dl-search-path = /usr/lib/pulse-4.0/modules
default-script-file = /etc/pulse/default.pa
load-default-script-file = yes
log-target = auto
log-level = notice
resample-method = speex-float-1
enable-remixing = yes
enable-lfe-remixing = no
default-sample-format = s16le
default-sample-rate = 44100
alternate-sample-rate = 48000
default-sample-channels = 2
default-channel-map = front-left,front-right
default-fragments = 8
default-fragment-size-msec = 10
enable-deferred-volume = yes
deferred-volume-safety-margin-usec = 1
deferred-volume-extra-delay-usec = 0
shm-size-bytes = 0
log-meta = no
log-time = no
log-backtrace = 0
rlimit-fsize = -1
rlimit-data = -1
rlimit-stack = -1
rlimit-core = -1
rlimit-rss = -1
rlimit-as = -1
rlimit-nproc = -1
rlimit-nofile = 256
rlimit-memlock = -1
rlimit-locks = -1
rlimit-sigpending = -1
rlimit-msgqueue = -1
rlimit-nice = 31
rlimit-rtprio = 9
rlimit-rttime = 1000000

Testing mycroft to insure its working or updates don’t screw stuff up

./start.sh cli

Input:
What time is it
Tell me a joke
What is my ip address
Search wikipedia for Terry Fox.
play some rock music.
play next track
pause next track
resume next track
search youtube for plush
close firefox.

Thanks for pointing out that typo, fixed it now.

Are you still having issues on your rPi or is it working now?

I have mopidy running on my desktop on a separate terminal rather than running it as a service. Same is true for pulse audio.

For desktop and pi, I would really like to get the mopidy running as a background service and have it play nicely with pulse audio.

I really like the desktop version because when I say hey mycroft (wake word) the volume is lowered to three, allowing me to speak my command. Then the volume is returned to previous level. Also I like the beep noise indicating that mycroft heard my wake word.

I will probably create a virtual machine version using ubuntu 16.04 as my guest machine and perform a start to finish install. This will allow me to experiment with all the skills available.

Hello, After a fresh install of Mycroft followed by a apt-get method of installing Mopidy and bunch of extensions, everything works fine (when I type in :mopidy). But the moment I turn mopidy into a service and restart, mopidy seems to loose it plot :slight_smile:

I have copied the config file from .config to /etc/mopidy/mopidy.conf and updated the config locations in the [core] section of the config file.

when i type in which mopidy i get - /usr/local/bin/mopidy

but when I go to the browser and check ip:6680. it loads the landing page of mopidy and doesn’t show up the list of frontends. iris doesn’t work (though i have it configured in the config file)

after running this as a service, when i check the status, it says mopidy is running but when i type in :mopidy in the command again, it says “ImportError: No module named gi” - which didn’t occur in the earlier case of running it manually (and not a service).

can anyone help in debugging/resolving this ?

any thoughts/suggestions please ? quick update - after re-installing / updating the configs (copying the same config file on /etc/mopidy and .config locations), the location has changed to usr/bin/mopidy but i still see a different config file when i type in sudo mopidyctl config -
Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config” as user mopidy
[core]
cache_dir = $XDG_CACHE_DIR/mopidy
config_dir = $XDG_CONFIG_DIR/mopidy
data_dir = $XDG_DATA_DIR/mopidy
max_tracklist_length = 10000
restore_state = false