Concatene the given music object to current one
966827
public void append(Music music) {
		//if appending a music from a part
		//add a PartLabel to all voices
		if (!music.m_partLabel.equals(" ")) {
            for (Object m_voice : m_voices) {
                ((Voice) m_voice).addElement(new PartLabel(music.m_partLabel));
            }
		}
        for (Object o : music.getVoices()) {
            Voice v = (Voice) o;
            if (!voiceExists(v.getVoiceName())) {
                //create new voice (in getVoice)
                //and copy v informations
                Voice vCopy = getVoice(v.getVoiceName());
                vCopy.setTablature(v.getTablature());
                vCopy.setVolume(v.getVolume());
                vCopy.setInstrument(v.getInstrument());
                //? vCopy.setFirstBarNumber(v.getFirstBar().getBarNumber());
            }
            getVoice(v.getVoiceName()).addAll(v);
        }
	}
229187
def transpose(obj, semitone):
    
    _check_supported(obj)
    copied = deepcopy(obj)
    copied.transpose(semitone)
    return copied
471603
private void addToMusic(MusicElement me) {
		if (me != null) {
			if (me instanceof DecorableElement)
				applySymbolsAndAnnotations((DecorableElement) me);
			if (!(me instanceof NotesSeparator)
					&& !(me instanceof Spacer)) {
				m_graceNotes.clear();
				m_graceNotesType = GracingType.APPOGGIATURA;
				//TODO attach graces to last parsed note ?
			}
			if ((m_tupletNumberOfNotes != -1)
				&& (me instanceof NoteAbstract)) {
				//we are filling a tuplet
				m_tupletNotes.add(me);
				if (m_tupletNotes.size() == m_tupletNumberOfNotes)
					closeTuplet();
			}
			m_music.getVoice(m_currentVoice).addElement(me);
		}
	}
465938
function mix(objs, deep) {
	const gobj = gawk(objs.shift());
	if (!isGawked(gobj) || Array.isArray(gobj)) {
		throw new TypeError('Expected destination to be a gawked object');
	}

	if (!objs.length) {
		return gobj;
	}

	// validate the objects are good
	for (const obj of objs) {
		if (!obj || typeof obj !== 'object' || Array.isArray(obj)) {
			throw new TypeError('Expected merge source to be an object');
		}
	}

	// we need to detach the parent and all listeners so that they will be notified after everything
	// has been merged
	gobj.__gawk__.pause();

	/**
	 * Mix an object or gawked object into a gawked object.
	 * @param {Object} gobj - The destination gawked object.
	 * @param {Object} src - The source object to copy from.
	 */
	const mixer = (gobj, src) => {
		for (const key of Object.getOwnPropertyNames(src)) {
			if (key === '__gawk__') {
				continue;
			}

			const srcValue = src[key];

			if (deep && srcValue !== null && typeof srcValue === 'object' && !Array.isArray(srcValue)) {
				if (!isGawked(gobj[key])) {
					gobj[key] = gawk({}, gobj);
				}
				mixer(gobj[key], srcValue);
			} else if (Array.isArray(gobj[key]) && Array.isArray(srcValue)) {
				// overwrite destination with new values
				gobj[key].splice(0, gobj[key].length, ...srcValue);
			} else {
				gobj[key] = gawk(srcValue, gobj);
			}
		}
	};

	for (const obj of objs) {
		mixer(gobj, obj);
	}

	gobj.__gawk__.resume();

	return gobj;
}
860307
def add_composition(self, composition):
        
        if not hasattr(composition, 'tracks'):
            raise UnexpectedObjectError("Object '%s' not expected. Expecting "
                    "a mingus.containers.Composition object." % composition)
        self.compositions.append(composition)
        return self
1156118
def instantiateSong(fileName):
    """"""
    ext = detectFormat(fileName)
    if(ext == "mp3"):
        return pd.AudioSegment.from_mp3(fileName)
    elif(ext == "wav"):
        return pd.AudioSegment.from_wav(fileName)
    elif(ext == "ogg"):
        return pd.AudioSegment.from_ogg(fileName)
    elif(ext == "flv"):
        return pd.AudioSegment.from_flv(fileName)
    elif(ext == "m4a"):
        return pd.AudioSegment.from_file(fileName, "mp4")
    else:
        return pd.AudioSegment.from_file(fileName, ext)
877161
public static String concat(final Object... osToString) {
        final StringBuilder b = new StringBuilder();
        if (osToString != null) {
            for (final Object o : osToString) {
                b.append(o != null ? o.toString() : "null");
            }
        }
        return b.toString();
    }
397236
function attributesToString(obj, prevObj, level) {
            var attrs = '',
                prefix,
                tab;
            level = level || 1;
            tab = getTabs(level, true);
            _.forEach(obj, function (v, k) {
                if(excludeAttrs.indexOf(k) === -1){
                    var prev = prevObj && prevObj[k] !== undefined ? prevObj[k] : undefined;
                    prefix = attrs.length ? ',\n' : '';
                    if(_.isPlainObject(v)){
                        var subAttr = attributesToString(v, prev, level +1);
                        if(subAttr && subAttr.length)
                            attrs += (prefix + tab + k + ': {\n' + subAttr + '\n' + tab + '}');
                    } else {
                        if(prev !== v){
                            var val = k === 'type' ? 'types.' + v : v;
                            if(_.isArray(val))
                                val = arrayToString(val);
                            if(_.isFunction(val)){
                                val = funcToString(val.toString(), 2);
                            }
                            attrs += (prefix + tab + k + ': ' + val);
                        }
                    }
                }
            });

            return attrs;
        }
532063
function (obj) {
        var str = ['{'];
        for (var key in obj) {
            if (!_.isUndefined(key)) {
                if (!_.isFunction(obj[key])) {
                    str.push(key + ':');
                    str.push(_.isUndefined(obj[key]) ? '""' : '"' + obj[key] + '"');
                    str.push(', ');
                }
            }
        }
        str.pop();
        str.push('}');
        return str.join('');
    }
858940
function play(name) {
        if (name === 'list') {
            return Object.keys(audio);
        }
        if (!(name in audio)) {
            d.error("Invalid audio name:", name);
            return;
        }

        audio[name].play();
    }
243159
function stringifySync(obj) {
	var output = "";
	var firstOccur = true;

	Object.keys(obj).forEach(function (key) {
		if (typeof obj[key] === "string") {
			output += key + "=" + obj[key];
			output += os.EOL;
		} else {
			if (firstOccur) {
				firstOccur = false;
			} else {
				output += os.EOL;
			}

			output += "[" + key + "]";
			output += os.EOL;
			Object.keys(obj[key]).forEach(function (innerKey) {
				var value = obj[key][innerKey];
				if (typeof value === "string") {
					// if value can ber converted to number or boolean,
					// but it should be a string,
					// so keep the quotes to indicate its type
					if (!isNaN(value) || value.toLowerCase() === "true" || value.toLowerCase() === "false") {
						value = "\"" + value + "\"";
					}
				}

				output += innerKey + "=" + value;
				output += os.EOL;
			});
		}
	});

	return output;
}
1018075
def dics_to_itunessd(header_dic, tracks_dics, playlists_dics_and_indexes):
    
    ############################################
    # header
    ######

    header_dic['length'] = get_table_size(header_table)
    header_dic['number_of_tracks'] = len(tracks_dics)
    header_dic['number_of_playlists'] = len(playlists_dics_and_indexes)
    header_dic['number_of_tracks2'] = 0

    header_part_size = get_table_size(header_table)

    ####################################################################################################################
    # tracks
    ##########

    # Chunk of header
    tracks_header_dic = {
        'length': get_table_size(tracks_header_table) + 4 * len(tracks_dics),
        'number_of_tracks': len(tracks_dics)
    }
    tracks_header_chunk = dic_to_chunk(tracks_header_dic, tracks_header_table)

    # Chunk of all tracks

    [track_dic.update({'length': get_table_size(track_table)}) for track_dic in tracks_dics]

    _tracks_chunks = [dic_to_chunk(dic, track_table) for dic in tracks_dics]

    all_tracks_chunck = b''.join(_tracks_chunks)

    # Chunk of offsets
    _length_before_tracks_offsets = header_part_size + len(tracks_header_chunk)
    tracks_offsets_chunck = get_offsets_chunk(_length_before_tracks_offsets, _tracks_chunks)

    # Put chunks together
    track_part_chunk = tracks_header_chunk + tracks_offsets_chunck + all_tracks_chunck

    ####################################################################################################################
    # playlists
    #############

    # Chunk of header
    _playlists_dics = [playlist_indexes[0] for playlist_indexes in playlists_dics_and_indexes]
    _types = [playlist_dic['type'] for playlist_dic in _playlists_dics]
    playlists_header_dic = {
        'length': get_table_size(playlists_header_table) + 4 * len(playlists_dics_and_indexes),
        'number_of_all_playlists': len(_types),
        'flag1': 0xffffffff if _types.count(NORMAL) == 0 else 1,
        'number_of_normal_playlists': _types.count(NORMAL),
        'flag2': 0xffffffff if _types.count(AUDIOBOOK) == 0 else (_types.count(MASTER) + _types.count(NORMAL) +
                                                                  _types.count(PODCAST)),
        'number_of_audiobook_playlists': _types.count(AUDIOBOOK),
        'flag3': 0xffffffff if _types.count(PODCAST) == 0 else _types.count(1) + _types.count(NORMAL),
        'number_of_podcast_playlists': _types.count(PODCAST)
    }
    playlists_header_chunk = dic_to_chunk(playlists_header_dic, playlists_header_table)

    # Chunk of all playlists
    _playlists_chunks = []
    for playlist_header_dic, indexes in playlists_dics_and_indexes:
        dic = playlist_header_dic.copy()
        dic['length'] = get_table_size(playlist_header_table) + 4 * len(indexes)
        dic['number_of_all_track'] = len(indexes)
        dic['number_of_normal_track'] = len(indexes) if dic['type'] in (1, 2) else 0

        if dic['type'] == MASTER:
            header_dic['number_of_tracks2'] = len(indexes)

        _playlist_header_chunk = dic_to_chunk(dic, playlist_header_table)
        _indexes_chunk = b''.join([i.to_bytes(4, 'little') for i in indexes])
        playlist_chunk = _playlist_header_chunk + _indexes_chunk

        _playlists_chunks.append(playlist_chunk)

    all_playlists_chunk = b''.join(_playlists_chunks)

    # Chunk of offsets
    _length_before_playlists_offsets = header_part_size + len(track_part_chunk) + len(playlists_header_chunk)
    playlists_offsets_chunk = get_offsets_chunk(_length_before_playlists_offsets, _playlists_chunks)

    # Put chunks together
    playlists_part_chunk = playlists_header_chunk + playlists_offsets_chunk + all_playlists_chunk

    ########################################################################
    header_dic['tracks_header_offset'] = header_part_size
    header_dic['playlists_header_offset'] = header_part_size + len(track_part_chunk)
    header_part_chunk = dic_to_chunk(header_dic, header_table)
    ########################################################################

    itunessd = header_part_chunk + track_part_chunk + playlists_part_chunk

    return itunessd
442228
def add_from_string(self, strdata):
        """"""
        if self.tree is None:
            self.tree = tree = ET.ElementTree(ET.fromstring(strdata))
            self.root = tree.getroot()
            self.objects = {}
        else:
            # TODO: append to current tree
            pass
819001
function(key, initValue, obj) {
    var isTimeProp = Audio.Clock.timeProperties.indexOf( key ) > -1,
        prop = obj.properties[ key ] = {
          value:  isTimeProp ? Audio.Clock.time( initValue ) : initValue,
          binops: [],
          parent : obj,
          name : key,
        },
        mappingName = key.charAt(0).toUpperCase() + key.slice(1);
    
    Object.defineProperty(obj, key, {
      configurable: true,
      get: function() { return prop.value },
      set: function(val) { 
        if( obj[ mappingName ] && obj[ mappingName ].mapping ) {
          if( obj[ mappingName ].mapping.remove )
            obj[ mappingName ].mapping.remove( true ) // pass true to avoid setting property inside of remove method
        }
        
        // if( isTimeProp ) {
        //   if( typeof val === 'object' && val.mode ==='absolute' ) { // ms, seconds
        //     prop.value = val.value
        //   }else{
        //     prop.value = Audio.Core.Binops.Mul( Audio.Clock.time( val ), Audio.Core.Binops.Div( 1, Audio.Clock.rate ) ) 
        //   }
        // }else{
        //   prop.value = val
        // }
        // 
        prop.value = isTimeProp ? Audio.Clock.time( val ) : val
        
        Audio.Core.dirty( obj )
        
        return prop.value
      },
    });

    obj[key] = prop.value
  }
1183575
function stringify(obj) {
  return Object.keys(obj || {})
    .reduce(function(str, prop){
      return str += ''
        + (str ? ' ' : '')
        + prop
        + ': '
        + obj[prop]
        + ';';
    }, '');
}
500876
function stringifyStrictObject( v , runtime )
{
	var i , iMax , keys ;
	
	runtime.str += '{' ;
	
	keys = Object.keys( v ) ;
	
	for ( i = 0 , iMax = keys.length ; i < iMax ; i ++ )
	{
		if ( v[ keys[ i ] ] !== undefined )
		{
			if ( i ) { runtime.str += ',' ; }
			stringifyString( keys[ i ] , runtime ) ;
			runtime.str += ':' ;
			stringifyAnyType( v[ keys[ i ] ] , runtime ) ;
		}
	}
	
	runtime.str += '}' ;
}
172268
function stringify(array) {
    var str = array.toString().split(',').map(function(item) {
      return "'" + item + "'";
    }).toString();
    return str;
  }