I am still trying to wrap my head around some of the D8 things. Working with some media bundles like media_audio_bundle and need to write some migration scripts. I have spent couple of days now researching and trying everything but nothing seems to work.
Its like Drupal wall all over again.
This is the closest I came:
$audio = \Drupal::entityTypeManager() ->getStorage('media_bundle') ->create(array( 'type' => 'media', 'bundle' => 'audio', 'title' => 'Another Audio', 'field_audio_file' => 11 ));
It seems to create some sort of media object but does not save it.
If somebody can help, would be much appreciated.